1 env GO111MODULE=on
2
3 # tidy removes unused y, but everything else is used
4 go mod tidy -v
5 stderr '^unused y.1'
6 ! stderr '^unused [^y]'
7
8 grep 'go 1.10' go.mod
9
10 go list -m all
11 ! stdout '^y'
12 stdout '^w.1 v1.2.0'
13 stdout '^z.1 v1.2.0'
14
15 # empty tidy should not crash
16 cd triv
17 ! grep 'go ' go.mod
18 go mod tidy
19
20 # tidy should add missing go line
21 grep 'go ' go.mod
22
23 -- go.mod --
24 module m
25
26 go 1.10
27
28 require (
29 x.1 v1.0.0
30 y.1 v1.0.0
31 w.1 v1.2.0
32 )
33
34 replace x.1 v1.0.0 => ./x
35 replace y.1 v1.0.0 => ./y
36 replace z.1 v1.1.0 => ./z
37 replace z.1 v1.2.0 => ./z
38 replace w.1 => ./w
39
40 -- m.go --
41 package m
42
43 import _ "x.1"
44 import _ "z.1/sub"
45
46 -- w/go.mod --
47 module w
48
49 -- w/w.go --
50 package w
51
52 -- x/go.mod --
53 module x
54 require w.1 v1.1.0
55 require z.1 v1.1.0
56
57 -- x/x.go --
58 package x
59 import _ "w.1"
60
61 -- y/go.mod --
62 module y
63 require z.1 v1.2.0
64
65 -- z/go.mod --
66 module z
67
68 -- z/sub/sub.go --
69 package sub
70
71 -- triv/go.mod --
72 module triv
73
View as plain text