1 [short] skip
2
3 env GO111MODULE=on
4
5 # 'go get' outside a module with an executable prints a deprecation message.
6 go get example.com/cmd/a
7 stderr '^go get: installing executables with ''go get'' in module mode is deprecated.$'
8 stderr 'Use ''go install pkg@version'' instead.'
9
10 cp 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.
14 go get rsc.io/quote
15 ! stderr deprecated
16 cp go.mod.orig go.mod
17
18 # 'go get' inside a module with an executable prints a different
19 # deprecation message.
20 go get example.com/cmd/a
21 stderr '^go get: installing executables with ''go get'' in module mode is deprecated.$'
22 stderr 'To adjust and download dependencies of the current module, use ''go get -d'''
23 cp go.mod.orig go.mod
24
25 # 'go get' should not print a warning for a main package inside the main module.
26 # The intent is most likely to update the dependencies of that package.
27 # 'go install' would be used otherwise.
28 go get m
29 ! stderr .
30 cp go.mod.orig go.mod
31
32 -- go.mod.orig --
33 module m
34
35 go 1.17
36 -- main.go --
37 package main
38
39 func main() {}
40
View as plain text