Skip to content

fix(version): go install reports the module version, not 0.0.0-dev#307

Merged
ion-alpha-dev merged 2 commits into
mainfrom
fix/go-install-version
Jul 7, 2026
Merged

fix(version): go install reports the module version, not 0.0.0-dev#307
ion-alpha-dev merged 2 commits into
mainfrom
fix/go-install-version

Conversation

@ion-alpha-dev

Copy link
Copy Markdown
Collaborator

What

When no release version is stamped through ldflags, resolve the version from the module version Go records in the build info, so a go install github.com/ionalpha/flynn/cmd/flynn@<version> build reports that version instead of 0.0.0-dev. Such a build is also treated as a real release rather than a development build for durable-state isolation.

Why

go install <module>@<version> does not pass the -ldflags -X ...version.Version= that the goreleaser build uses, so flynn --version printed 0.0.0-dev even when installed at a tagged release, and IsDev() routed it to the development data directory. Go stamps the resolved module version into the binary's build info, so using it as the fallback gives the correct version and data-directory behavior. A goreleaser build is unaffected (its ldflags version wins), and a plain source checkout still reports the dev default plus its VCS revision.

How to verify

go test ./internal/version/ passes, including TestStampedVersionWins (an ldflags version is reported verbatim and is not a dev build) and TestModuleVersionFallback (a real module version is used, while (devel) and an empty version are not). End to end: go install github.com/ionalpha/flynn/cmd/flynn@<next-tag> then flynn --version prints the tag rather than 0.0.0-dev.

….0.0-dev

A binary built with go install <module>@<version> does not get the release
version through ldflags the way a goreleaser build does, so flynn --version
printed 0.0.0-dev even when installed at a real tag. Fall back to the module
version Go records in the build info when no ldflags version is set, and treat
such a build as a real release (not a dev build) for durable-state isolation.
A plain source checkout still reports the dev default with its VCS revision.
@ion-alpha-dev ion-alpha-dev merged commit 5619e77 into main Jul 7, 2026
16 checks passed
@ion-alpha-dev ion-alpha-dev deleted the fix/go-install-version branch July 7, 2026 05:26
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant