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/+/212317Reviewed-by: Jay Conrod <jayconrod@google.com>
Showing
Please register or sign in to comment