]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.17] cmd/go: avoid +incompatible major versions if a go.mod file...
authorBryan C. Mills <bcmills@google.com>
Wed, 23 Feb 2022 16:55:08 +0000 (11:55 -0500)
committerCarlos Amedee <carlos@golang.org>
Thu, 3 Mar 2022 14:29:59 +0000 (14:29 +0000)
commit7f04645b7a3b061ccbef6f8ba1cbb31f398eb20a
treee700e029b88ad0f1a2cd9758a8d476499aa0e32b
parent7d8fa657893f93dd04071bb164166d12fbdeb8a5
[release-branch.go1.17] cmd/go: avoid +incompatible major versions if a go.mod file exists in a subdirectory for that version

Previous versions of the 'go' command would reject a pseudo-version
passed to 'go get' if that pseudo-version had a mismatched major
version and lacked a "+incompatible" suffix. However, they would
erroneously accept a version *with* a "+incompatible" suffix even if
the repo contained a vN/go.mod file for the same major version, and
would generate a "+incompatible" pseudo-version or version if the user
requested a tag, branch, or commit hash.

This change uniformly rejects "vN.…" without "+incompatible", and also
avoids resolving to "vN.…+incompatible", when vN/go.mod exists.
To maintain compatibility with existing go.mod files, it still accepts
"vN.…+incompatible" if the version is requested explicitly as such
and the repo root lacks a go.mod file.

Fixes #51332
Updates #51324
Updates #36438

Change-Id: I2b16150c73fc2abe4d0a1cd34cb1600635db7139
Reviewed-on: https://go-review.googlesource.com/c/go/+/387675
Trust: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
(cherry picked from commit 5a9fc946b42cc987db41eabcfcbaffd2fb310d94)
Reviewed-on: https://go-review.googlesource.com/c/go/+/387922
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
src/cmd/go/internal/modfetch/coderepo.go
src/cmd/go/internal/modfetch/coderepo_test.go