...
1env GO111MODULE=on
2
3# Regression test for golang.org/issue/31031:
4# Importing or loading a non-existent package in cmd/ should print
5# a clear error in module mode.
6
7! go list cmd/unknown
8stderr '^package cmd/unknown is not in std \('$GOROOT'[/\\]src[/\\]cmd[/\\]unknown\)$'
9
10go list -f '{{range .DepsErrors}}{{.Err}}{{end}}' x.go
11stdout '^package cmd/unknown is not in std \('$GOROOT'[/\\]src[/\\]cmd[/\\]unknown\)$'
12
13-- x.go --
14package x
15
16import _ "cmd/unknown"
View as plain text