mirror of
https://github.com/golang/go
synced 2024-11-26 01:57:56 -07:00
cmd/go/internal/modload: ignore selected version in checkRetractions
Fixes #42601 Change-Id: I58d817ed34ccbd39591326c4bc23569f94028412 Reviewed-on: https://go-review.googlesource.com/c/go/+/272006 Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Jay Conrod <jayconrod@google.com>
This commit is contained in:
parent
9264067a41
commit
012efc67f2
@ -114,9 +114,9 @@ func CheckRetractions(ctx context.Context, m module.Version) error {
|
||||
|
||||
// Find the latest version of the module.
|
||||
// Ignore exclusions from the main module's go.mod.
|
||||
// We may need to account for the current version: for example,
|
||||
// v2.0.0+incompatible is not "latest" if v1.0.0 is current.
|
||||
rev, err := Query(ctx, path, "latest", Selected(path), nil)
|
||||
const ignoreSelected = ""
|
||||
var allowAll AllowedFunc
|
||||
rev, err := Query(ctx, path, "latest", ignoreSelected, allowAll)
|
||||
if err != nil {
|
||||
return &entry{nil, err}
|
||||
}
|
||||
|
19
src/cmd/go/testdata/mod/example.com_retract_incompatible_v1.0.0.txt
vendored
Normal file
19
src/cmd/go/testdata/mod/example.com_retract_incompatible_v1.0.0.txt
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
The v1.0.0 release of example.com/retract/incompatible retracts
|
||||
v2.0.0+incompatible.
|
||||
|
||||
-- .mod --
|
||||
module example.com/retract/incompatible
|
||||
|
||||
go 1.16
|
||||
|
||||
retract v2.0.0+incompatible
|
||||
-- .info --
|
||||
{"Version":"v1.0.0"}
|
||||
-- go.mod --
|
||||
module example.com/retract/incompatible
|
||||
|
||||
go 1.16
|
||||
|
||||
retract v2.0.0+incompatible
|
||||
-- incompatible.go --
|
||||
package incompatible
|
9
src/cmd/go/testdata/mod/example.com_retract_incompatible_v2.0.0+incompatible.txt
vendored
Normal file
9
src/cmd/go/testdata/mod/example.com_retract_incompatible_v2.0.0+incompatible.txt
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
The v1.0.0 release of example.com/retract/incompatible retracts
|
||||
v2.0.0+incompatible.
|
||||
|
||||
-- .mod --
|
||||
module example.com/retract/incompatible
|
||||
-- .info --
|
||||
{"Version":"v2.0.0+incompatible"}
|
||||
-- incompatible.go --
|
||||
package incompatible
|
15
src/cmd/go/testdata/script/mod_retract_incompatible.txt
vendored
Normal file
15
src/cmd/go/testdata/script/mod_retract_incompatible.txt
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
# The current version of a module should not be considered when loading
|
||||
# retractions. If the current version is +incompatible, we should not prefer
|
||||
# +incompatible versions when looking for retractions.
|
||||
# Verifies #42601.
|
||||
|
||||
go mod init m
|
||||
|
||||
# Request a +incompatible version retracted in v1.0.0.
|
||||
go get -d example.com/retract/incompatible@v2.0.0+incompatible
|
||||
stderr '^go: warning: example.com/retract/incompatible@v2.0.0\+incompatible: retracted by module author$'
|
||||
|
||||
# We should still see a warning if the +incompatible was previously in the
|
||||
# build list.
|
||||
go get -d example.com/retract/incompatible@v2.0.0+incompatible
|
||||
stderr '^go: warning: example.com/retract/incompatible@v2.0.0\+incompatible: retracted by module author$'
|
Loading…
Reference in New Issue
Block a user