...
1cd 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
6go get ./...
7stderr -count=1 'matched no packages'
8
9go get ./...
10stderr -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
15go get example.net/emptysubdir/... # control case
16
17! go get example.net/emptysubdir/subdir/...
18! stderr 'matched no packages'
19stderr '^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
30stderr '^go: builtin/...: malformed module path "builtin": missing dot in first path element$'
31
32cd ../subdirmod
33go get work
34stderr -count=1 'matched no packages'
35
36-- go.mod --
37module example.net/emptysubdir
38
39go 1.16
40-- emptysubdir.go --
41// Package emptysubdir has a subdirectory containing no packages.
42package emptysubdir
43-- subdir/README.txt --
44This module intentionally does not contain any p
45-- subdirmod/go.mod --
46module example.net/emptysubdir/subdirmod
47
48go 1.16
View as plain text