| 1 |
cd subdir |
| 2 |
|
| 3 |
# 'go get' on empty patterns that are necessarily local to the module |
| 4 |
# should warn that the patterns are empty, exactly once. |
| 5 |
|
| 6 |
go get ./... |
| 7 |
stderr -count=1 'matched no packages' |
| 8 |
|
| 9 |
go get ./... |
| 10 |
stderr -count=1 'matched no packages' |
| 11 |
|
| 12 |
# 'go get' on patterns that could conceivably match nested modules |
| 13 |
# should report a module resolution error. |
| 14 |
|
| 15 |
go get example.net/emptysubdir/... # control case |
| 16 |
|
| 17 |
! go get example.net/emptysubdir/subdir/... |
| 18 |
! stderr 'matched no packages' |
| 19 |
stderr '^go: example\.net/emptysubdir/subdir/\.\.\.: module example\.net/emptysubdir/subdir: reading http://.*: 404 Not Found\n\tserver response: 404 page not found\n\z' |
| 20 |
|
| 21 |
# It doesn't make sense to 'go get' a path in the standard library, |
| 22 |
# since the standard library necessarily can't have unresolved imports. |
| 23 |
# |
| 24 |
# TODO(#30241): Maybe that won't always be the case? |
| 25 |
# |
| 26 |
# For that case, we emit a "malformed module path" error message, |
| 27 |
# which isn't ideal either. |
| 28 |
|
| 29 |
! go get builtin/... # in GOROOT/src, but contains no packages |
| 30 |
stderr '^go: builtin/...: malformed module path "builtin": missing dot in first path element$' |
| 31 |
|
| 32 |
cd ../subdirmod |
| 33 |
go get work |
| 34 |
stderr -count=1 'matched no packages' |
| 35 |
|
| 36 |
-- go.mod -- |
| 37 |
module example.net/emptysubdir |
| 38 |
|
| 39 |
go 1.16 |
| 40 |
-- emptysubdir.go -- |
| 41 |
// Package emptysubdir has a subdirectory containing no packages. |
| 42 |
package emptysubdir |
| 43 |
-- subdir/README.txt -- |
| 44 |
This module intentionally does not contain any p |
| 45 |
-- subdirmod/go.mod -- |
| 46 |
module example.net/emptysubdir/subdirmod |
| 47 |
|
| 48 |
go 1.16 |