summaryrefslogtreecommitdiffstats
path: root/src/cmd/go/testdata/script/mod_enabled.txt
blob: 39f1ece8cb8eea2ce1e65715ed6dce0d681957b7 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# GO111MODULE=auto should trigger any time a go.mod exists in a parent directory.
env GO111MODULE=auto

cd $GOPATH/src/x/y/z
go env GOMOD
stdout $GOPATH[/\\]src[/\\]x[/\\]y[/\\]z[/\\]go.mod
go list -m -f {{.GoMod}}
stdout $GOPATH[/\\]src[/\\]x[/\\]y[/\\]z[/\\]go.mod

cd $GOPATH/src/x/y/z/w
go env GOMOD
stdout $GOPATH[/\\]src[/\\]x[/\\]y[/\\]z[/\\]go.mod

cd $GOPATH/src/x/y
go env GOMOD
! stdout .

cd $GOPATH/foo
go env GOMOD
stdout foo[/\\]go.mod
go list -m -f {{.GoMod}}
stdout foo[/\\]go.mod

cd $GOPATH/foo/bar/baz
go env GOMOD
stdout foo[/\\]go.mod

# GO111MODULE unset should be equivalent to on.
env GO111MODULE=

cd $GOPATH/src/x/y/z
go env GOMOD
stdout $GOPATH[/\\]src[/\\]x[/\\]y[/\\]z[/\\]go.mod

cd $GOPATH/src/x/y
go env GOMOD
stdout 'NUL|/dev/null'

# GO111MODULE=on should trigger everywhere
env GO111MODULE=on

cd $GOPATH/src/x/y/z
go env GOMOD
stdout z[/\\]go.mod

cd $GOPATH/src/x/y/z/w
go env GOMOD
stdout z[/\\]go.mod

cd $GOPATH/src/x/y
go env GOMOD
stdout 'NUL|/dev/null'
go list -m
stdout '^command-line-arguments$'

cd $GOPATH/foo
go env GOMOD
stdout foo[/\\]go.mod

cd $GOPATH/foo/bar/baz
go env GOMOD
stdout foo[/\\]go.mod

# GO111MODULE=off should trigger nowhere
env GO111MODULE=off

cd $GOPATH/src/x/y/z
go env GOMOD
! stdout .+

cd $GOPATH/foo
go env GOMOD
! stdout .+

cd $GOPATH/foo/bar/baz
go env GOMOD
! stdout .+

# GO111MODULE=auto should ignore and warn about /tmp/go.mod
env GO111MODULE=auto
cp $GOPATH/src/x/y/z/go.mod $WORK/tmp/go.mod
mkdir $WORK/tmp/mydir
cd $WORK/tmp/mydir
go env GOMOD
! stdout .+
stderr '^go: warning: ignoring go.mod in system temp root '

-- $GOPATH/src/x/y/z/go.mod --
module x/y/z
-- $GOPATH/src/x/y/z/w/w.txt --
-- $GOPATH/foo/go.mod --
module example.com/mod
-- $GOPATH/foo/bar/baz/quux.txt --