...

Text file src/cmd/go/testdata/script/std_vendor.txt

Documentation: cmd/go/testdata/script

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

View as plain text