]> Cypherpunks repositories - gostls13.git/commit
cmd/go: adjust heuristics for skipping +incompatible versions
authorBryan C. Mills <bcmills@google.com>
Fri, 20 Dec 2019 22:12:38 +0000 (17:12 -0500)
committerBryan C. Mills <bcmills@google.com>
Wed, 8 Jan 2020 20:07:45 +0000 (20:07 +0000)
commit817afe83578d869b36e8697344bb2d557c86b264
treed87cf8e468f48576fc89ce0a28a34c1b1c580fe3
parent2248fc63ab53f90020e77df3fbd131a539d68fd4
cmd/go: adjust heuristics for skipping +incompatible versions

We know of at least one module (github.com/stripe/stripe-go) that has
a run of +incompatible versions, followed by a run of versions with
go.mod files, followed by another run of +incompatible versions.

We want the heuristics for showing +incompatible versions to reflect
the authors' current intent, and it seems clear that the current
intent of the authors of that module is for users of the unversioned
import path to still be on +incompatible versions.

To respect that intent, we need to keep checking for +incompatible
versions even after we have seen a lower major version with an
explicit go.mod file.

However, we still don't want to download every single version of the
module to check it. A given major version should have a consistent,
canonical import path, so the path (as inferred by the presence or
absence of a go.mod file) should be the same for every release across
that major version.

To avoid unnecessary overhead — and to allow module authors to correct
accidental changes to a major version's import path — we check only
the most recent release of each major version. If a release
accidentally changes the import path in either direction (by deleting
or adding a go.mod file), it can be corrected by issuing a single
subsequent release of that major version to restore the correct path.

I manually verified that, with this change,
github.com/stripe/stripe-go@latest reverts to v68.7.0+incompatible
as it was in Go 1.13.
The other regression tests for #34165 continue to pass.

Updates #34165

Change-Id: I5daff3cd2123f94c7c49519babf4eecd509f169e
Reviewed-on: https://go-review.googlesource.com/c/go/+/212317
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/modfetch/coderepo.go