]> Cypherpunks repositories - gostls13.git/commit
cmd/go: avoid upgrading to +incompatible versions if the latest compatible one has...
authorBryan C. Mills <bcmills@google.com>
Wed, 30 Oct 2019 15:44:43 +0000 (11:44 -0400)
committerBryan C. Mills <bcmills@google.com>
Wed, 6 Nov 2019 02:49:10 +0000 (02:49 +0000)
commitde70de6ede7ffbbec5ab206658f60c9a9eeb49dd
tree8e250170e1ad571c09be7b6a13d76b678ca49cda
parent649f341e95626afa56ca67c5595c8f35780b29a8
cmd/go: avoid upgrading to +incompatible versions if the latest compatible one has a go.mod file

Previously we would always “upgrade” to the semantically-highest
version, even if a newer compatible version exists.

That made certain classes of mistakes irreversible: in general we
expect users to address bad releases by releasing a new (higher)
version, but if the bad release was an unintended +incompatible
version, then no release that includes a go.mod file can ever have a
higher version, and the bad release will be treated as “latest”
forever.

Instead, when considering a +incompatible version we now consult the
latest compatible (v0 or v1) release first. If the compatible release
contains a go.mod file, we ignore the +incompatible releases unless
they are expicitly requested (by version, commit ID, or branch name).

Fixes #34165
Updates #34189

Change-Id: I7301eb963bbb91b21d3b96a577644221ed988ab7
Reviewed-on: https://go-review.googlesource.com/c/go/+/204440
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
doc/go1.14.html
src/cmd/go/internal/modfetch/repo.go
src/cmd/go/internal/modload/query.go
src/cmd/go/testdata/script/mod_prefer_compatible.txt [new file with mode: 0644]