...
1! go list -export ./...
2stderr '^# example.com/p2\np2'${/}'main\.go:7:.*'
3! stderr '^go build '
4
5go list -f '{{with .Error}}{{.}}{{end}}' -e -export ./...
6! stderr '.'
7stdout '^# example.com/p2\np2'${/}'main\.go:7:.*'
8
9go list -export -e -f '{{.ImportPath}} -- {{.Incomplete}} -- {{.Error}}' ./...
10stdout 'example.com/p1 -- false -- <nil>'
11stdout 'example.com/p2 -- true -- # example.com/p2'
12
13go list -e -export -json=Error ./...
14stdout '"Err": "# example.com/p2'
15
16-- go.mod --
17module example.com
18-- p1/p1.go --
19package p1
20
21const Name = "p1"
22-- p2/main.go --
23package main
24
25import "fmt"
26import "example.com/p1"
27
28func main() {
29 fmt.Println(p1.Name == 5)
30}
View as plain text