Skip to content

Fall back to embedded build info for Version - #163

Merged
andrew merged 1 commit into
mainfrom
version-buildinfo-fallback
Sep 16, 2026
Merged

andrew merged 1 commit into
mainfrom
version-buildinfo-fallback

Conversation

@andrew

@andrew andrew commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

go install github.com/git-pkgs/forge/cmd/forge@<tag> builds without goreleaser's -ldflags -X, so forge version reports dev. Read debug.ReadBuildInfo().Main.Version when the ldflag var is at its default so go install users see the tag they installed. The ldflag still wins for release builds.

go install does not apply goreleaser's -ldflags -X, so binaries
installed that way reported 'dev'. Read debug.BuildInfo.Main.Version
when the ldflag is unset.
@andrew
andrew merged commit a49c77a into main Sep 16, 2026
7 checks passed
@andrew
andrew deleted the version-buildinfo-fallback branch September 16, 2026 08:25
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