...

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

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2env GOPROXY=off
     3
     4[!compiler:gc] skip
     5[short] skip
     6
     7# Outside of GOROOT, our vendored packages should be reported as part of the standard library.
     8go list -f '{{if .Standard}}{{.ImportPath}}{{end}}' std cmd
     9stdout ^vendor/golang\.org/x/net/http2/hpack
    10stdout ^cmd/vendor/golang\.org/x/arch/x86/x86asm
    11! stdout ^golang\.org/x/
    12
    13# The dependencies of those packages should also be vendored.
    14go list -deps vendor/golang.org/x/crypto/chacha20
    15stdout ^vendor/golang\.org/x/crypto/internal/alias
    16
    17# cmd/... should match the same packages it used to match in GOPATH mode.
    18go list cmd/...
    19stdout ^cmd/compile
    20! stdout ^cmd/vendor/golang\.org/x/arch/x86/x86asm
    21
    22# GOROOT/src/... should list the packages in std as if it were a module
    23# dependency: omitting vendored dependencies and stopping at the 'cmd' module
    24# boundary.
    25
    26go list $GOROOT/src/...
    27stdout ^bytes$
    28! stdout ^builtin$
    29! stdout ^cmd/
    30! stdout ^vendor/
    31! stdout ^golang\.org/x/
    32
    33
    34# Vendored dependencies should appear with their 'vendor/' paths in std (they're
    35# in GOROOT/src, but not in the 'std' module following the usual module-boundary
    36# rules).
    37
    38cd $GOROOT/src
    39env GOWORK=off
    40
    41go list std
    42stdout ^vendor/golang.org/x/net/http2/hpack
    43! stdout ^golang\.org/x
    44
    45# The dependencies of packages with an explicit 'vendor/' prefix should
    46# still themselves resolve to vendored packages.
    47go list -deps vendor/golang.org/x/crypto/chacha20
    48stdout ^vendor/golang.org/x/crypto/internal/alias
    49! stdout ^golang\.org/x
    50
    51# Within the std module, the dependencies of the non-vendored packages within
    52# std should appear to be packages beginning with 'vendor/', not 'golang.org/…'
    53# module dependencies.
    54
    55go list all
    56! stdout ^golang.org/x/
    57! stdout ^std/
    58! stdout ^cmd/
    59stdout ^vendor/
    60
    61go list -deps -f '{{if not .Standard}}{{.ImportPath}}{{end}}' std
    62! stdout .
    63
    64# However, the 'golang.org/…' module dependencies should resolve to those same
    65# directories.
    66
    67go list -f '{{.Dir}}' golang.org/x/net/http2/hpack
    68stdout $GOROOT[/\\]src[/\\]vendor
    69
    70# Within the std module, the packages within the module should omit the 'std/'
    71# prefix (they retain their own identities), but should respect normal module
    72# boundaries (vendored packages are not included in the module, even though they
    73# are included in the 'std' pattern).
    74
    75go list ./...
    76stdout ^bytes$
    77! stdout ^builtin$
    78! stdout ^cmd/
    79! stdout ^vendor/
    80! stdout ^golang\.org/x/
    81
    82
    83# Within std, the vendored dependencies of cmd should still appear to be part of cmd.
    84
    85go list -f '{{if .Standard}}{{.ImportPath}}{{end}}' cmd
    86stdout ^cmd/vendor/golang\.org/x/arch/x86/x86asm
    87
    88go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' cmd
    89! stdout .
    90
    91go list cmd/...
    92stdout ^cmd/compile
    93! stdout ^cmd/vendor/golang\.org/x/arch/x86/x86asm

View as plain text