1 # Regression test for https://go.dev/issue/60313: 'go mod tidy' did not preserve
2 # dependencies needed to prevent 'ambiguous import' errors in external test
3 # dependencies.
4
5 cp go.mod go.mod.orig
6 go mod tidy
7 cmp go.mod go.mod.orig
8
9 -- go.mod --
10 module example
11
12 go 1.21
13
14 require (
15 example.net/a v0.1.0
16 example.net/b v0.1.0
17 )
18
19 require example.net/outer/inner v0.1.0 // indirect
20
21 replace (
22 example.net/a v0.1.0 => ./a
23 example.net/b v0.1.0 => ./b
24 example.net/outer v0.1.0 => ./outer
25 example.net/outer/inner v0.1.0 => ./inner
26 )
27 -- example.go --
28 package example
29
30 import (
31 _ "example.net/a"
32 _ "example.net/b"
33 )
34 -- a/go.mod --
35 module example.net/a
36
37 go 1.21
38
39 require example.net/outer/inner v0.1.0
40 -- a/a.go --
41 package a
42 -- a/a_test.go --
43 package a_test
44
45 import _ "example.net/outer/inner"
46 -- b/go.mod --
47 module example.net/b
48
49 go 1.21
50
51 require example.net/outer v0.1.0
52 -- b/b.go --
53 package b
54 -- b/b_test.go --
55 package b_test
56
57 import _ "example.net/outer/inner"
58 -- inner/go.mod --
59 module example.net/outer/inner
60
61 go 1.21
62 -- inner/inner.go --
63 package inner
64 -- outer/go.mod --
65 module example.net/outer
66
67 go 1.21
68 -- outer/inner/inner.go --
69 package inner
70
View as plain text