A binary from go install reports version dev although it was built from the tagged release #422

Closed
opened 2026-11-11 01:01:45 +01:00 by clawbot · 2 comments
Collaborator

Found by the acceptance test (#418).

Steps to reproduce

  • Run the first command of the README: go install sneak.berlin/go/vaultik/cmd/vaultik@latest. Go resolves it to v1.0.0-rc3.
  • Run vaultik version.

What happened

The first line is vaultik dev, with commit: unknown, and the text says "This is a development build: it was not built from a tagged commit". The binary knows better: go version -m on it shows mod sneak.berlin/go/vaultik v1.0.0-rc3, and debug.ReadBuildInfo() returns that version at run time.

What should happen

When the linker flags carry no version, vaultik version and the banner fall back to the module version from the build info, so a go install of a tag reports that tag and is called a release. Every bug report from a user who followed the README otherwise says "dev".

Not blocking.

Model: fable-5-1

Found by the acceptance test (https://git.eeqj.de/sneak/vaultik/issues/418). **Steps to reproduce** - Run the first command of the README: `go install sneak.berlin/go/vaultik/cmd/vaultik@latest`. Go resolves it to `v1.0.0-rc3`. - Run `vaultik version`. **What happened** The first line is `vaultik dev`, with `commit: unknown`, and the text says "This is a development build: it was not built from a tagged commit". The binary knows better: `go version -m` on it shows `mod sneak.berlin/go/vaultik v1.0.0-rc3`, and `debug.ReadBuildInfo()` returns that version at run time. **What should happen** When the linker flags carry no version, `vaultik version` and the banner fall back to the module version from the build info, so a `go install` of a tag reports that tag and is called a release. Every bug report from a user who followed the README otherwise says "dev". Not blocking. Model: fable-5-1
Author
Collaborator

Plan. Fall back to the build info when the linker flags set no version.

  • When globals.Version holds the value it has without -ldflags (dev, or empty), take the main module's version from debug.ReadBuildInfo(). If the build info holds vcs.revision and vcs.time, set Commit and CommitDate from them the same way. A (devel) module version counts as no version.
  • vaultik version, the banner and IsDevVersion then treat a go install of a tag as that release.
  • Builds through the Makefile, script/docker and goreleaser are unchanged: their linker flags still win.
  • Tests: the fallback, fed a build info with a tagged module version, and with (devel).

Package: internal/globals, where the version variables live.

For every unit from the acceptance test

  • One branch off current next, one PR with base next, labelled needs-review and assigned to clawbot. The title ends (closes #N).
  • Add nothing to docs/TODO.md. sneak ruled on 11 November that it is not a history document (#440).
  • README.md on next: change only a sentence the fix makes false. The rewritten README in #399 is with sneak and is updated after this merges.
  • A test that fails on current next shows the fix. Run make fmt and make check before the final push.

Model: opus-5-5

Plan. Fall back to the build info when the linker flags set no version. - When `globals.Version` holds the value it has without `-ldflags` (`dev`, or empty), take the main module's version from `debug.ReadBuildInfo()`. If the build info holds `vcs.revision` and `vcs.time`, set `Commit` and `CommitDate` from them the same way. A `(devel)` module version counts as no version. - `vaultik version`, the banner and `IsDevVersion` then treat a `go install` of a tag as that release. - Builds through the `Makefile`, `script/docker` and goreleaser are unchanged: their linker flags still win. - Tests: the fallback, fed a build info with a tagged module version, and with `(devel)`. Package: `internal/globals`, where the version variables live. **For every unit from the acceptance test** - One branch off current `next`, one PR with base `next`, labelled `needs-review` and assigned to `clawbot`. The title ends `(closes #N)`. - Add nothing to `docs/TODO.md`. sneak ruled on 11 November that it is not a history document (https://git.eeqj.de/sneak/vaultik/issues/440). - `README.md` on `next`: change only a sentence the fix makes false. The rewritten README in https://git.eeqj.de/sneak/vaultik/pulls/399 is with sneak and is updated after this merges. - A test that fails on current `next` shows the fix. Run `make fmt` and `make check` before the final push. Model: opus-5-5
clawbot self-assigned this 2026-11-11 01:12:27 +01:00
Author
Collaborator

Built in #444, as planned above. One addition: IsDevVersion now also counts Go pseudo-versions and +dirty as development builds, since a plain go build in a checkout records those and would otherwise report itself as a release.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/vaultik/pulls/444, as planned above. One addition: `IsDevVersion` now also counts Go pseudo-versions and `+dirty` as development builds, since a plain `go build` in a checkout records those and would otherwise report itself as a release. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/vaultik#422