...
1env 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
7stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
8! go mod graph
9stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
10! go mod verify
11stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
12! go mod download
13stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
14
15# Same result in an empty directory
16mkdir z
17cd z
18! go mod init
19stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
20! go mod graph
21stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
22! go mod verify
23stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
24! go mod download
25stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
26
27-- sample.go --
28package sample
29
30func main() {}
31
32-- go.mod --
33module sample
34
35go 1.12
View as plain text