| 1 |
[short] skip |
| 2 |
|
| 3 |
env GO111MODULE=on |
| 4 |
|
| 5 |
# 'go get' outside a module prints an error. |
| 6 |
! go get example.com/cmd/a |
| 7 |
stderr '^go: go.mod file not found in current directory or any parent directory.$' |
| 8 |
stderr '^\t''go get'' is no longer supported outside a module.$' |
| 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 |
! stderr 'no longer installs' |
| 17 |
cp 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. |
| 23 |
go get example.com/cmd/a |
| 24 |
! stderr deprecated |
| 25 |
! stderr 'no longer installs' |
| 26 |
cp 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. |
| 31 |
go get m |
| 32 |
! stderr . |
| 33 |
cp go.mod.orig go.mod |
| 34 |
|
| 35 |
-- go.mod.orig -- |
| 36 |
module m |
| 37 |
|
| 38 |
go 1.17 |
| 39 |
-- main.go -- |
| 40 |
package main |
| 41 |
|
| 42 |
func main() {} |