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,--rollbackand--pin=<tag>read the version Go recorded in the downloaded binary, after the checksum and signature checks, and fail withsetup.ErrVersionMismatchwhen it isn't the release asked for.--forcemakes no difference.--allow-version-mismatchinstalls it with a warning. - A binary that records no release version is refused when
update.require_signatureapplies, 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.
releasemanifestrefuses to publish a binary whose recorded version isn't the release's tag.
What to do¶
- Build releases in a git checkout whose
HEADcarries the release tag, with Go 1.24 or later and without-buildvcs=false. GoReleaser on a tag pipeline already does. - A tool whose
mainis in a nested module needs the tag with the module's prefix as well, such ascli/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
vprefix records no release version, because Go can't use that tag. - To see what a build records:
go version -m ./mytool, themodline. - Tag each release with a full version, such as
v1.2.3.v1.2,v01.2.3,cli/v1.2.3and a bare date are not versions. - A Bitbucket tool can't do that today:
updatetakes only the download named<tool>_<OS>_<arch>.tar.gz, so the release is tagged with its upload time.update --forceinstalls it with a warning, unless signatures are required. Then every update is refused,--from-fileincluded, 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.