aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/std_vendor.txt
blob: 6cb015fc0778dd14ffe58509c7f53c8a6a66f84e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
env GO111MODULE=off

[!gc] skip

# 'go list' should report imports from _test.go in the TestImports field.
go list -f '{{.TestImports}}'
stdout net/http # from .TestImports

# 'go list' should report standard-vendored packages by path.
go list -f '{{.Dir}}' vendor/golang.org/x/net/http2/hpack
stdout $GOROOT[/\\]src[/\\]vendor

# 'go list -test' should report vendored transitive dependencies of _test.go
# imports in the Deps field, with a 'vendor' prefix on their import paths.
go list -test -f '{{.Deps}}'
stdout golang.org/x/crypto # dep of .TestImports

# Packages outside the standard library should not use its copy of vendored packages.
cd broken
! go build
stderr 'cannot find package'

-- go.mod --
module m

-- x.go --
package x

-- x_test.go --
package x
import "testing"
import _ "net/http"
func Test(t *testing.T) {}

-- broken/go.mod --
module broken
-- broken/http.go --
package broken

import (
	_ "net/http"
	_ "golang.org/x/net/http/httpproxy"
)