1 env GO111MODULE=off
2
3 [!gc] skip
4
5 # 'go list' should report imports from _test.go in the TestImports field.
6 go list -f '{{.TestImports}}'
7 stdout net/http # from .TestImports
8
9 # 'go list' should report standard-vendored packages by path.
10 go list -f '{{.Dir}}' vendor/golang.org/x/net/http2/hpack
11 stdout $GOROOT[/\\]src[/\\]vendor
12
13 # 'go list -test' should report vendored transitive dependencies of _test.go
14 # imports in the Deps field, with a 'vendor' prefix on their import paths.
15 go list -test -f '{{.Deps}}'
16 stdout golang.org/x/crypto # dep of .TestImports
17
18 # Packages outside the standard library should not use its copy of vendored packages.
19 cd broken
20 ! go build
21 stderr 'cannot find package'
22
23 -- go.mod --
24 module m
25
26 -- x.go --
27 package x
28
29 -- x_test.go --
30 package x
31 import "testing"
32 import _ "net/http"
33 func Test(t *testing.T) {}
34
35 -- broken/go.mod --
36 module broken
37 -- broken/http.go --
38 package broken
39
40 import (
41 _ "net/http"
42 _ "golang.org/x/net/http/httpproxy"
43 )
44
View as plain text