aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_get_deprecate_install.txt
blob: 63cd27a42d2bc76911d0e36f589adb4f97259f22 (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
[short] skip

env GO111MODULE=on

# 'go get' outside a module with an executable prints a deprecation message.
go get example.com/cmd/a
stderr '^go get: installing executables with ''go get'' in module mode is deprecated.$'
stderr 'Use ''go install pkg@version'' instead.'

cp go.mod.orig go.mod

# 'go get' inside a module with a non-main package does not print a message.
# This will stop building in the future, but it's the command we want to use.
go get rsc.io/quote
! stderr deprecated
cp go.mod.orig go.mod

# 'go get' inside a module with an executable prints a different
# deprecation message.
go get example.com/cmd/a
stderr '^go get: installing executables with ''go get'' in module mode is deprecated.$'
stderr 'To adjust and download dependencies of the current module, use ''go get -d'''
cp go.mod.orig go.mod

# 'go get' should not print a warning for a main package inside the main module.
# The intent is most likely to update the dependencies of that package.
# 'go install' would be used otherwise.
go get m
! stderr .
cp go.mod.orig go.mod

-- go.mod.orig --
module m

go 1.17
-- main.go --
package main

func main() {}