]> Cypherpunks repositories - gostls13.git/commit
cmd/go: don't attempt to downgrade to incompatible versions
authorJay Conrod <jayconrod@google.com>
Wed, 15 May 2019 16:47:05 +0000 (12:47 -0400)
committerJay Conrod <jayconrod@google.com>
Fri, 17 May 2019 16:39:37 +0000 (16:39 +0000)
commit06642d8e77ae23325de1db177366c902ec75ab1e
treed9b1ad63c9f3a76d0ad9057efb75cc1301a66e1b
parent703fb665d68ac96ae193891ffae2774c2a3deb4b
cmd/go: don't attempt to downgrade to incompatible versions

When we downgrade a module (using 'go get m@none' or similar), we
exclude versions of other modules that depend on it. We'll try
previous versions (in the "versions" list returned by the proxy or in
codeRepo.Versions for vcs) until we find a version that doesn't
require an excluded module version.

If older versions of a module are broken for some reason,
mvs.Downgrade currently panics. With this change, we ignore versions
with errors during downgrade.

A frequent cause of this is incompatible v2+ versions. These are
common if a repository tagged v2.0.0 before migrating to modules, then
tagged v2.0.1 with a go.mod file later. v2.0.0 is incorrectly
considered part of the v2 module.

Fixes #31942

Change-Id: Icaa75c5c93f73f18a400c22f18a8cc603aa4011a
Reviewed-on: https://go-review.googlesource.com/c/go/+/177337
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/go/internal/mvs/mvs.go
src/cmd/go/testdata/mod/example.com_downgrade_v2.0.0.txt [new file with mode: 0644]
src/cmd/go/testdata/mod/example.com_downgrade_v2_v2.0.1.txt [new file with mode: 0644]
src/cmd/go/testdata/mod/example.com_latemigrate_v2_v2.0.0.txt [new file with mode: 0644]
src/cmd/go/testdata/mod/example.com_latemigrate_v2_v2.0.1.txt [new file with mode: 0644]
src/cmd/go/testdata/script/mod_get_downgrade.txt