1 env GO111MODULE=on
2
3 # explicit get should report errors about bad names
4 ! go get appengine
5 stderr '^go: malformed module path "appengine": missing dot in first path element$'
6 ! go get x/y.z
7 stderr 'malformed module path "x/y.z": missing dot in first path element'
8
9
10 # 'go list -m' should report errors about module names, never GOROOT.
11 ! go list -m -versions appengine
12 stderr 'malformed module path "appengine": missing dot in first path element'
13 ! go list -m -versions x/y.z
14 stderr 'malformed module path "x/y.z": missing dot in first path element'
15
16
17 # build should report all unsatisfied imports,
18 # but should be more definitive about non-module import paths
19 ! go build ./useappengine
20 stderr '^useappengine[/\\]x.go:2:8: cannot find package$'
21 ! go build ./usenonexistent
22 stderr '^usenonexistent[/\\]x.go:2:8: no required module provides package nonexistent.rsc.io; to add it:\n\tgo get nonexistent.rsc.io$'
23
24
25 # 'get -d' should be similarly definitive
26
27 go get ./useappengine # TODO(#41315): This should fail.
28 # stderr '^useappengine[/\\]x.go:2:8: cannot find package$'
29
30 ! go get ./usenonexistent
31 stderr '^x/usenonexistent imports\n\tnonexistent.rsc.io: cannot find module providing package nonexistent.rsc.io$'
32
33
34 # go mod vendor and go mod tidy should ignore appengine imports.
35 rm usenonexistent/x.go
36 go mod tidy
37 go mod vendor
38
39 -- go.mod --
40 module x
41
42 -- useappengine/x.go --
43 package useappengine
44 import _ "appengine" // package does not exist
45 -- usenonexistent/x.go --
46 package usenonexistent
47 import _ "nonexistent.rsc.io" // domain does not exist
48
View as plain text