1 # This test checks error messages for non-existent packages in module mode.
2 # Veries golang.org/issue/35414
3 env GO111MODULE=on
4 cd $WORK
5
6 go list -e -f {{.Error}} .
7 stdout 'no Go files in '$WORK
8
9 go list -e -f {{.Error}} ./empty
10 stdout 'no Go files in '$WORK${/}'empty'
11
12 go list -e -f {{.Error}} ./exclude
13 stdout 'build constraints exclude all Go files in '$WORK${/}'exclude'
14
15 go list -e -f {{.Error}} ./missing
16 stdout 'stat '$WORK'[/\\]missing: directory not found'
17
18 # use 'go build -n' because 'go list' reports no error.
19 ! go build -n ./testonly
20 stderr 'example.com/m/testonly: no non-test Go files in '$WORK${/}'testonly'
21
22 -- $WORK/go.mod --
23 module example.com/m
24
25 go 1.14
26
27 -- $WORK/empty/empty.txt --
28 -- $WORK/exclude/exclude.go --
29 // +build exclude
30
31 package exclude
32 -- $WORK/testonly/testonly_test.go --
33 package testonly_test
34 -- $WORK/excluded-stdout --
35 package ./excluded: cannot find package "." in:
36 $WORK/excluded
37
View as plain text