Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go/internal/modload: scan dependencies of root paths when raising…
… version limits in editRequirements Fixes #47979 Change-Id: I1d9d854cda1378e20c70e6c6789b77e42e467ca7 Reviewed-on: https://go-review.googlesource.com/c/go/+/347290 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
- Loading branch information
Bryan C. Mills
committed
Sep 8, 2021
1 parent
054710c
commit 409434d
Showing
2 changed files
with
195 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# Regression test for https://golang.org/issue/47979: | ||
# | ||
# An argument to 'go get' that results in an upgrade to a different existing | ||
# root should be allowed, and should not panic the 'go' command. | ||
|
||
cp go.mod go.mod.orig | ||
|
||
|
||
# Transitive upgrades from upgraded roots should not prevent | ||
# 'go get -u' from performing upgrades. | ||
|
||
cp go.mod.orig go.mod | ||
go get -u -d . | ||
cmp go.mod go.mod.want | ||
|
||
|
||
# 'go get' of a specific version should allow upgrades of | ||
# every dependency (transitively) required by that version, | ||
# including dependencies that are pulled into the module | ||
# graph by upgrading other root requirements | ||
# (in this case, example.net/indirect). | ||
|
||
cp go.mod.orig go.mod | ||
go get -d example.net/a@v0.2.0 | ||
cmp go.mod go.mod.want | ||
|
||
|
||
-- go.mod -- | ||
module golang.org/issue47979 | ||
|
||
go 1.17 | ||
|
||
replace ( | ||
example.net/a v0.1.0 => ./a1 | ||
example.net/a v0.2.0 => ./a2 | ||
example.net/indirect v0.1.0 => ./indirect1 | ||
example.net/indirect v0.2.0 => ./indirect2 | ||
example.net/other v0.1.0 => ./other | ||
example.net/other v0.2.0 => ./other | ||
) | ||
|
||
require ( | ||
example.net/a v0.1.0 | ||
example.net/other v0.1.0 | ||
) | ||
|
||
require example.net/indirect v0.1.0 // indirect | ||
-- go.mod.want -- | ||
module golang.org/issue47979 | ||
|
||
go 1.17 | ||
|
||
replace ( | ||
example.net/a v0.1.0 => ./a1 | ||
example.net/a v0.2.0 => ./a2 | ||
example.net/indirect v0.1.0 => ./indirect1 | ||
example.net/indirect v0.2.0 => ./indirect2 | ||
example.net/other v0.1.0 => ./other | ||
example.net/other v0.2.0 => ./other | ||
) | ||
|
||
require ( | ||
example.net/a v0.2.0 | ||
example.net/other v0.2.0 | ||
) | ||
|
||
require example.net/indirect v0.2.0 // indirect | ||
-- issue.go -- | ||
package issue | ||
|
||
import _ "example.net/a" | ||
-- useother/useother.go -- | ||
package useother | ||
|
||
import _ "example.net/other" | ||
-- a1/go.mod -- | ||
module example.net/a | ||
|
||
go 1.17 | ||
|
||
require example.net/indirect v0.1.0 | ||
-- a1/a.go -- | ||
package a | ||
-- a2/go.mod -- | ||
module example.net/a | ||
|
||
go 1.17 | ||
|
||
require example.net/indirect v0.2.0 | ||
-- a2/a.go -- | ||
package a | ||
|
||
import "example.net/indirect" | ||
-- indirect1/go.mod -- | ||
module example.net/indirect | ||
|
||
go 1.17 | ||
|
||
require example.net/other v0.1.0 | ||
-- indirect1/indirect.go -- | ||
package indirect | ||
-- indirect2/go.mod -- | ||
module example.net/indirect | ||
|
||
go 1.17 | ||
|
||
require example.net/other v0.2.0 | ||
-- indirect2/indirect.go -- | ||
package indirect | ||
|
||
import "example.net/other" | ||
-- other/go.mod -- | ||
module example.net/other | ||
|
||
go 1.17 | ||
-- other/other.go -- | ||
package other |