feat: display app version in UI footer
Some checks failed
CI / Deploy / test (pull_request) Successful in 15s
CI / Deploy / lint (pull_request) Failing after 2s
CI / Deploy / deploy (pull_request) Has been skipped

- Add version package with build-time variables
- Inject version via ldflags in Dockerfile using git describe
- Show version in footer on every page
- Log version and commit on server startup
This commit is contained in:
Ryan Hamamura
2026-03-03 09:23:37 -10:00
parent 513467470c
commit 66dbcfc751
4 changed files with 24 additions and 4 deletions

View File

@@ -20,6 +20,7 @@ import (
"github.com/ryanhamamura/games/router"
"github.com/ryanhamamura/games/sessions"
"github.com/ryanhamamura/games/snake"
"github.com/ryanhamamura/games/version"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
@@ -45,7 +46,7 @@ func main() {
func run(ctx context.Context) error {
cfg := config.Global
addr := fmt.Sprintf("%s:%s", cfg.Host, cfg.Port)
slog.Info("server starting", "addr", addr)
slog.Info("server starting", "addr", addr, "version", version.Version, "commit", version.Commit)
defer slog.Info("server shutdown complete")
eg, egctx := errgroup.WithContext(ctx)