Skip to content

Embed and expose build/VCS info#365

Merged
jfberry merged 1 commit into
mainfrom
feat/build-info
May 26, 2026
Merged

Embed and expose build/VCS info#365
jfberry merged 1 commit into
mainfrom
feat/build-info

Conversation

@jfberry
Copy link
Copy Markdown
Collaborator

@jfberry jfberry commented May 26, 2026

Summary

  • Remove .git from .dockerignore so Go's automatic VCS embedding works inside container builds
  • Read vcs.revision / vcs.modified / vcs.time via runtime/debug.ReadBuildInfo() at startup
  • Log version on startup: Golbat starting: revision=<sha> modified=<bool> built=<rfc3339>
  • Add unauthenticated GET /version returning JSON with revision, modified flag, build time, and Go version

No build flags or -ldflags are needed — Go embeds this automatically when building inside a git checkout (which the Dockerfile now is).

Test plan

  • go build -tags go_json ./... succeeds
  • go vet -tags go_json ./... clean
  • Local binary logs revision=… modified=… built=… at startup
  • In CI/Docker, confirm the same line appears in container logs and GET /version returns populated fields
  • Verify modified=false on a clean tagged build

🤖 Generated with Claude Code

Go's toolchain auto-embeds VCS metadata (revision, modified flag, build
time) into binaries built from a git checkout. Read it via
runtime/debug.ReadBuildInfo at startup so operators can verify exactly
which commit a running golbat was built from.

- Remove .git from .dockerignore so VCS info reaches container builds
- Log revision/modified/build-time at startup
- Add unauthenticated GET /version endpoint returning the same fields
  plus Go version

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jfberry jfberry merged commit 92075c0 into main May 26, 2026
4 checks passed
@jfberry jfberry deleted the feat/build-info branch May 26, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant