mirror of
https://github.com/golang/go
synced 2024-11-26 05:07:59 -07:00
cmd/go: ensure 'go get -u' can upgrade pruned (1.17+) modules
Fixes #47768 Change-Id: I981a31ba4ff716570ac4c6f35b289fa480faa5bb Reviewed-on: https://go-review.googlesource.com/c/go/+/343879 Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
parent
b602daea1b
commit
bdc1bef8a0
@ -237,6 +237,7 @@ func raiseLimitsForUpgrades(ctx context.Context, maxVersion map[string]string, d
|
||||
continue
|
||||
}
|
||||
|
||||
allow(m)
|
||||
for _, r := range summary.require {
|
||||
allow(r)
|
||||
}
|
||||
|
68
src/cmd/go/testdata/script/mod_get_lazy_upgrade_lazy.txt
vendored
Normal file
68
src/cmd/go/testdata/script/mod_get_lazy_upgrade_lazy.txt
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
# Check that 'go get -u' will upgrade a dependency (direct or indirect)
|
||||
# when the main module and the dependency are both lazy.
|
||||
# Verifies #47768.
|
||||
|
||||
# Check that go.mod is tidy, and an upgrade is available.
|
||||
cp go.mod go.mod.orig
|
||||
go mod tidy
|
||||
cmp go.mod go.mod.orig
|
||||
|
||||
go list -m -u example.com/lazyupgrade
|
||||
stdout '^example.com/lazyupgrade v0.1.0 \[v0.1.1\] => ./lazyupgrade@v0.1.0$'
|
||||
|
||||
# 'go get -u' on a package that directly imports the dependency should upgrade.
|
||||
go get -u ./usedirect
|
||||
go list -m example.com/lazyupgrade
|
||||
stdout '^example.com/lazyupgrade v0.1.1 => ./lazyupgrade@v0.1.1$'
|
||||
cp go.mod.orig go.mod
|
||||
|
||||
# 'go get -u' on a package that indirectly imports the dependency should upgrade.
|
||||
go get -u ./useindirect
|
||||
go list -m example.com/lazyupgrade
|
||||
stdout '^example.com/lazyupgrade v0.1.1 => ./lazyupgrade@v0.1.1$'
|
||||
|
||||
-- go.mod --
|
||||
module use
|
||||
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
direct v0.0.0
|
||||
example.com/lazyupgrade v0.1.0
|
||||
)
|
||||
|
||||
replace (
|
||||
direct => ./direct
|
||||
example.com/lazyupgrade v0.1.0 => ./lazyupgrade@v0.1.0
|
||||
example.com/lazyupgrade v0.1.1 => ./lazyupgrade@v0.1.1
|
||||
)
|
||||
-- usedirect/usedirect.go --
|
||||
package use
|
||||
|
||||
import _ "example.com/lazyupgrade"
|
||||
-- useindirect/useindirect.go --
|
||||
package use
|
||||
|
||||
import _ "direct"
|
||||
-- direct/go.mod --
|
||||
module direct
|
||||
|
||||
go 1.17
|
||||
|
||||
require example.com/lazyupgrade v0.1.0
|
||||
-- direct/direct.go --
|
||||
package direct
|
||||
|
||||
import _ "example.com/lazyupgrade"
|
||||
-- lazyupgrade@v0.1.0/go.mod --
|
||||
module example.com/lazyupgrade
|
||||
|
||||
go 1.17
|
||||
-- lazyupgrade@v0.1.0/lazyupgrade.go --
|
||||
package lazyupgrade
|
||||
-- lazyupgrade@v0.1.1/go.mod --
|
||||
module example.com/lazyupgrade
|
||||
|
||||
go 1.17
|
||||
-- lazyupgrade@v0.1.1/lazyupgrade.go --
|
||||
package lazyupgrade
|
Loading…
Reference in New Issue
Block a user