Repository navigation
feat: extend --version with commit, date, dirty flag, and build profile - #228
justin13888 wants to merge 1 commit into
Conversation
Add Commit, Dirty, BuildDate, and BuildProfile ldflags variables so --version outputs granular build identification details. Falls back to debug.ReadBuildInfo() for dev builds without injected ldflags. Update Makefile to inject all metadata for build/install/install-dev/ build-all targets, and .goreleaser.yml to pass ShortCommit, Date, and profile=release for release pipeline builds.
|
This resolves #227 |
|
Hey @justin13888! Starling here (AI assistant on the project). 👋 Nice — this is the standard Go pattern for build info, done right. A few observations:
The output format in the issue looks clean and readable. Flagging @marcus to review and merge — this one seems pretty ready. ✦ |
|
Hi @justin13888, and apologies for the long silence here. You got a comment back in March saying this looked ready to merge, and then it sat. That is on me. Here is where things landed. Since this PR opened, the managed dev install path in So I am closing this rather than asking you to rebase into a moving target. I want to be clear that the PR was not the problem. It was clean, and it sat too long, and the ground shifted underneath it. The part your PR solved that is still unsolved is release builds. Goreleaser still injects only the bare version, so a Homebrew binary cannot be traced back to a commit or a build date. Rather than leave that on the floor, I am pulling that piece of your work in directly, adapted to fit the current version scheme, with you credited on the commit. #227 stays open until it lands. Thanks for the contribution, and sorry again for the wait. |
A released binary printed only `sidecar version v1.9.0`, so a bug report from a Homebrew install could not be traced to a commit. Release builds now carry ShortCommit and the build date from goreleaser, `make build`/`make install` stamp commit and dirty state, and builds without ldflags fall back to debug.ReadBuildInfo. The first line stays exactly `sidecar version <v>`: dev-install.sh matches it by prefix and verify-release-archives.sh compared the whole output, which is now a first-line comparison. Detail goes on indented lines below. The Makefile deliberately does not stamp main.Version. These are unmanaged builds of possibly-unreleased code, and a `git describe` tag would make internal/version read them as an up-to-date release and stop offering updates. Adapted from #228 by @justin13888, which predated the composite version string that scripts/dev-install.sh now builds. Closes #227. Co-Authored-By: Justin Chung <20733699+justin13888@users.noreply.github.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ut1zrG8kFmZQpPAkTYzCkd
Add Commit, Dirty, BuildDate, and BuildProfile ldflags variables so --version outputs granular build identification details. Falls back to debug.ReadBuildInfo() for dev builds without injected ldflags.
Update Makefile to inject all metadata for build/install/install-dev/ build-all targets, and .goreleaser.yml to pass ShortCommit, Date, and profile=release for release pipeline builds.