...
1[short] skip
2
3env GO111MODULE=on
4
5# 'go get' outside a module prints an error.
6! go get example.com/cmd/a
7stderr '^go: go.mod file not found in current directory or any parent directory.$'
8stderr '^\t''go get'' is no longer supported outside a module.$'
9
10cp go.mod.orig go.mod
11
12# 'go get' inside a module with a non-main package does not print a message.
13# This will stop building in the future, but it's the command we want to use.
14go get rsc.io/quote
15! stderr deprecated
16! stderr 'no longer installs'
17cp go.mod.orig go.mod
18
19# 'go get' inside a module with an executable does not print a message.
20# In 1.16 and 1.17, 'go get' did print a message in this case suggesting the
21# use of -d. In 1.18, -d is a no-op, and we'd like to begin discouraging
22# its use.
23go get example.com/cmd/a
24! stderr deprecated
25! stderr 'no longer installs'
26cp go.mod.orig go.mod
27
28# 'go get' should not print a warning for a main package inside the main module.
29# The intent is most likely to update the dependencies of that package.
30# 'go install' would be used otherwise.
31go get m
32! stderr .
33cp go.mod.orig go.mod
34
35-- go.mod.orig --
36module m
37
38go 1.17
39-- main.go --
40package main
41
42func main() {}
View as plain text