Skip to content

v0.x: update checks the binary's version

update installs a release only when its binary is the version asked for (spec 0220). A tool picks this up with the gtb release that ships it. No exported signature changes.

What changes

  • A mismatch is refused. update, update --version, --rollback and --pin=<tag> read the version Go recorded in the downloaded binary, after the checksum and signature checks, and fail with setup.ErrVersionMismatch when it isn't the release asked for. --force makes no difference. --allow-version-mismatch installs it with a warning.
  • A binary that records no release version is refused when update.require_signature applies, and installs with a warning otherwise. So is a release whose tag isn't a version, such as a Bitbucket download, which is tagged with its upload time.
  • A release fetched by tag must carry that tag. A manifest or forge release that names another is refused, and no flag changes that.
  • releasemanifest refuses to publish a binary whose recorded version isn't the release's tag.

What to do

  • Build releases in a git checkout whose HEAD carries the release tag, with Go 1.24 or later and without -buildvcs=false. GoReleaser on a tag pipeline already does.
  • A tool whose main is in a nested module needs the tag with the module's prefix as well, such as cli/v1.2.3.
  • From v2 the module path needs its major version, such as /v2, because Go can't use a v2 tag without it.
  • A tool that tags without the v prefix records no release version, because Go can't use that tag.
  • To see what a build records: go version -m ./mytool, the mod line.
  • Tag each release with a full version, such as v1.2.3. v1.2, v01.2.3, cli/v1.2.3 and a bare date are not versions.
  • A Bitbucket tool can't do that today: update takes only the download named <tool>_<OS>_<arch>.tar.gz, so the release is tagged with its upload time. update --force installs it with a warning, unless signatures are required. Then every update is refused, --from-file included, because it can't verify a signature either.
  • A tool that requires signatures can no longer roll back to a release it built without a recorded version.