diff options
| author | Bryan C. Mills <bcmills@google.com> | 2023-05-19 16:01:02 -0400 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-05-22 21:02:28 +0000 |
| commit | 53e0616c13ca6b4da472eb4e9b2cba397b51b253 (patch) | |
| tree | 50b8d81f91ee458017e6383f679c90771fe8ecea /src | |
| parent | 5abfdc8c75b13edbe3ccc918df47dd2da85454d8 (diff) | |
| download | go-53e0616c13ca6b4da472eb4e9b2cba397b51b253.tar.xz | |
cmd/go: add a test that reproduces an unstable 'go mod tidy'
For #60313.
Change-Id: I76e48f52341e9962de9b809741a677d61baae6a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/496518
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/go/testdata/script/mod_tidy_issue60313.txt | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/cmd/go/testdata/script/mod_tidy_issue60313.txt b/src/cmd/go/testdata/script/mod_tidy_issue60313.txt new file mode 100644 index 0000000000..1ae2c13b74 --- /dev/null +++ b/src/cmd/go/testdata/script/mod_tidy_issue60313.txt @@ -0,0 +1,76 @@ +# Regression test for https://go.dev/issue/60313: 'go mod tidy' did not preserve +# dependencies needed to prevent 'ambiguous import' errors in external test +# dependencies. + +go mod tidy +cp go.mod tidy1.mod + +! go mod tidy # BUG: This should succeed and leave go.mod unchanged. + # cmp go.mod tidy1.mod +stderr 'ambiguous import' + +-- go.mod -- +module example + +go 1.21 + +require ( + example.net/a v0.1.0 + example.net/b v0.1.0 +) + +require example.net/outer/inner v0.1.0 // indirect + +replace ( + example.net/a v0.1.0 => ./a + example.net/b v0.1.0 => ./b + example.net/outer v0.1.0 => ./outer1 + example.net/outer/inner v0.1.0 => ./inner +) +-- example.go -- +package example + +import ( + _ "example.net/a" + _ "example.net/b" +) +-- a/go.mod -- +module example.net/a + +go 1.21 + +require example.net/outer/inner v0.1.0 +-- a/a.go -- +package a +-- a/a_test.go -- +package a_test + +import _ "example.net/outer/inner" +-- b/go.mod -- +module example.net/b + +go 1.21 + +require example.net/outer v0.1.0 +-- b/b.go -- +package b +-- b/b_test.go -- +package b_test + +import _ "example.net/outer/inner" +-- inner/go.mod -- +module example.net/outer/inner + +go 1.21 +-- inner/inner.go -- +package inner +-- outer1/go.mod -- +module example.net/outer + +go 1.21 +-- outer1/inner/inner.go -- +package inner +-- outer2/go.mod -- +module example.net/outer + +go 1.21 |
