env GO111MODULE=off

[!compiler: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"
)
