Skip to content

fix: stamp release binaries with version, commit, date and builder - #1764

Open
Eljees wants to merge 1 commit into
mgechev:masterfrom
Eljees:fix/787-goreleaser-ldflags
Open

fix: stamp release binaries with version, commit, date and builder#1764
Eljees wants to merge 1 commit into
mgechev:masterfrom
Eljees:fix/787-goreleaser-ldflags

Conversation

@Eljees

@Eljees Eljees commented Aug 7, 2026

Copy link
Copy Markdown

Fixes #787.

cli/main.go expects its version metadata in package-level variables — cli.version, cli.commit, cli.date, cli.builtBy — but .goreleaser.yml has no ldflags section, so releases get GoReleaser's default stamping of main.version et al., which lands in the wrong package and leaves the variables at their defaults. The BUILDER=GoReleaser build env declared there is not read by anything; it is removed.

One honest note: the symptom has drifted since the issue was filed. Go now embeds VCS build info, so an unstamped binary reports a pseudo-version rather than the (devel) from 2023:

$ revive -version        # built exactly as releases are built today
version 0.0.0-20260727054359-0ac11a611ddf+dirty

With the ldflags from this change (same -X paths, sample values):

Version:	1.99.0-test
Commit:		deadbeef
Built		2026-08-07T00:00:00Z by GoReleaser

-s -w is kept explicitly because overriding ldflags replaces GoReleaser's defaults rather than extending them.

AI-assisted (LLM used for drafting); the runs above are mine.

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.

Missing version output in revive -version in goreleaser released files

1 participant