summaryrefslogtreecommitdiffstats
path: root/src/cmd/go/testdata/script/mod_tidy.txt
blob: b1d9371217c4bf4b5e7f2289505d576bf2ad4d5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
env GO111MODULE=on

# tidy removes unused y, but everything else is used
go mod tidy -v
stderr '^unused y.1'
! stderr '^unused [^y]'

grep 'go 1.10' go.mod

go list -m all
! stdout '^y'
stdout '^w.1 v1.2.0'
stdout '^z.1 v1.2.0'

# empty tidy should not crash
cd triv
! grep 'go ' go.mod
go mod tidy

# tidy should add missing go line
grep 'go ' go.mod

-- go.mod --
module m

go 1.10

require (
	x.1 v1.0.0
	y.1 v1.0.0
	w.1 v1.2.0
)

replace x.1 v1.0.0 => ./x
replace y.1 v1.0.0 => ./y
replace z.1 v1.1.0 => ./z
replace z.1 v1.2.0 => ./z
replace w.1 => ./w

-- m.go --
package m

import _ "x.1"
import _ "z.1/sub"

-- w/go.mod --
module w

-- w/w.go --
package w

-- x/go.mod --
module x
require w.1 v1.1.0
require z.1 v1.1.0

-- x/x.go --
package x
import _ "w.1"

-- y/go.mod --
module y
require z.1 v1.2.0

-- z/go.mod --
module z

-- z/sub/sub.go --
package sub

-- triv/go.mod --
module triv