1 env GO111MODULE=on
2
3 # By default, 'go get' should ignore tests
4 cp go.mod.empty go.mod
5 go get m/a
6 ! grep rsc.io/quote go.mod
7
8 # 'go get -t' should consider test dependencies of the named package.
9 cp go.mod.empty go.mod
10 go get -t m/a
11 grep 'rsc.io/quote v1.5.2$' go.mod
12
13 # 'go get -t' should not consider test dependencies of imported packages,
14 # including packages imported from tests.
15 cp go.mod.empty go.mod
16 go get -t m/b
17 ! grep rsc.io/quote go.mod
18
19 # 'go get -t -u' should update test dependencies of the named package.
20 cp go.mod.empty go.mod
21 go mod edit -require=rsc.io/quote@v1.5.1
22 go get -t -u m/a
23 grep 'rsc.io/quote v1.5.2$' go.mod
24
25 # 'go get -t -u' should not add or update test dependencies
26 # of imported packages, including packages imported from tests.
27 cp go.mod.empty go.mod
28 go get -t -u m/b
29 ! grep rsc.io/quote go.mod
30 go mod edit -require=rsc.io/quote@v1.5.1
31 go get -t -u m/b
32 grep 'rsc.io/quote v1.5.1$' go.mod
33
34 # 'go get all' should consider test dependencies with or without -t.
35 cp go.mod.empty go.mod
36 go get all
37 grep 'rsc.io/quote v1.5.2$' go.mod
38
39 -- go.mod.empty --
40 module m
41
42 -- a/a.go --
43 package a
44
45 -- a/a_test.go --
46 package a_test
47
48 import _ "rsc.io/quote"
49
50 -- b/b.go --
51 package b
52
53 import _ "m/a"
54
55 -- b/b_test.go --
56 package b_test
57
58 import _ "m/a"
59
View as plain text