1 env GO111MODULE=off
2
3 # This script tests that running go mod with
4 # GO111MODULE=off when outside of GOPATH will fatal
5 # with an error message, even with some source code in the directory and a go.mod.
6 ! go mod init
7 stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
8 ! go mod graph
9 stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
10 ! go mod verify
11 stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
12 ! go mod download
13 stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
14
15 # Same result in an empty directory
16 mkdir z
17 cd z
18 ! go mod init
19 stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
20 ! go mod graph
21 stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
22 ! go mod verify
23 stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
24 ! go mod download
25 stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
26
27 -- sample.go --
28 package sample
29
30 func main() {}
31
32 -- go.mod --
33 module sample
34
35 go 1.12
36
View as plain text