Black Lives Matter. Support the Equal Justice Initiative.

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

Documentation: cmd/go/testdata/script

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

View as plain text