Skip to content

A built binary must name the tag it was built from - #28

Merged
naturalmoods merged 1 commit into
mainfrom
fix-release-version-string
Aug 18, 2026
Merged

naturalmoods merged 1 commit into
mainfrom
fix-release-version-string

Conversation

@naturalmoods

Copy link
Copy Markdown
Owner

Found while running #13's post-release checks on the published v1.1.0 artifact.

released artifact : aipocket 1.1.0
go install build  : aipocket v1.1.0
git tag           : v1.1.0

goreleaser's {{.Version}} strips the leading v; Go's module version always carries it. So one release answers "which version am I running" two different ways — in aipocket version and in the User-Agent a provider sees — while the README promises that question has an answer, on the grounds that it is the one worth being able to answer after a security advisory.

The fix, and the gate that keeps it

  • .goreleaser.yaml: ldflags interpolate {{.Tag}}. Archive names keep .Version — their download URLs are already public, and the v is not conventional there.
  • release.yml: a new step extracts the linux amd64 binary and requires aipocket version to equal the tag. It runs after the build and before the release is published, so a mismatch fails the job while the release is still a draft and never becomes a download — the same reasoning the publish step already documents about attestations.

Without the gate the fix holds only until the next person reaches for .Version.

Rehearsed in both directions

A shell step in a workflow has no other way to be tested, so I ran it locally against real archives:

built with aipocket version gate
-X main.version=v1.1.0 aipocket v1.1.0 passes
-X main.version=1.1.0 (the old behaviour) aipocket 1.1.0 fails, with the intended message

About v1.1.0 itself

Its published archives keep saying 1.1.0. They are attested and cannot be rewritten, and this does not justify a v1.1.1 on its own — the next tag will be consistent, and #13 records the discrepancy for anyone comparing the two.

🤖 Generated with Claude Code

v1.1.0 shipped calling itself "1.1.0". goreleaser's .Version is the tag with the
leading v stripped, while a `go install` build of the same commit reports
"v1.1.0", because Go's module version always carries the v. So one release
answered "which version am I running" two different ways — in `aipocket version`
and in the User-Agent a provider sees — and the README promises that question has
an answer, on the grounds that it is the one worth being able to answer after a
security advisory.

The ldflags now interpolate .Tag. Archive names keep .Version, because their
download URLs are already public and the v is not conventional there.

The fix on its own would hold until the next person reached for .Version, so the
release workflow now checks it: after the build and before the release is
published, it extracts the linux amd64 binary and requires `aipocket version` to
equal the tag. A mismatch fails the job while the release is still a draft, so it
cannot become a download. That placement is the same reasoning the publish step
already documents about attestations.

The step was rehearsed locally in both directions, since a shell step in a
workflow has no other way to be tested: built with .Tag it passes, built the old
v-stripped way it fails with the message it should.

v1.1.0's published archives keep saying 1.1.0. They are attested and cannot be
rewritten, and this is not worth a v1.1.1 on its own — the next tag will be
consistent, and #13 records the discrepancy for anyone comparing the two.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@naturalmoods
naturalmoods merged commit 6d2398f into main Aug 18, 2026
5 checks passed
@naturalmoods
naturalmoods deleted the fix-release-version-string branch August 18, 2026 10:22
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