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

     1  # https://golang.org/issue/44725: packages in std should have the same
     2  # dependencies regardless of whether they are listed from within or outside
     3  # GOROOT/src.
     4  
     5  env GOROOT=$WORK/goroot
     6  
     7  # Control case: net, viewed from outside the 'std' module,
     8  # should depend on vendor/golang.org/… instead of golang.org/….
     9  
    10  go list -deps net
    11  stdout '^vendor/golang.org/x/net'
    12  ! stdout '^golang.org/x/net'
    13  cp stdout $WORK/net-deps.txt
    14  
    15  
    16  # It should still report the same package dependencies when viewed from
    17  # within GOROOT/src.
    18  
    19  cd $GOROOT/src
    20  
    21  go list -deps net
    22  stdout '^vendor/golang.org/x/net'
    23  ! stdout '^golang.org/x/net'
    24  cmp stdout $WORK/net-deps.txt
    25  
    26  
    27  # However, 'go mod' and 'go get' subcommands should report the original module
    28  # dependencies, not the vendored packages.
    29  
    30  env GOWORK=off
    31  go mod why -m golang.org/x/net
    32  stdout '^# golang.org/x/net\nnet\ngolang.org/x/net'
    33  
    34  -- $WORK/goroot/src/go.mod --
    35  module std
    36  
    37  go 1.26
    38  
    39  require golang.org/x/net v0.1.0
    40  -- $WORK/goroot/src/go.sum --
    41  golang.org/x/net v0.1.0 h1:iUcD2VNMwNi3BZMUg2qIGo4aAass7E0R4eQNGK3hvc0=
    42  golang.org/x/net v0.1.0/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
    43  -- $WORK/goroot/src/vendor/modules.txt --
    44  # golang.org/x/net v0.1.0
    45  ## explicit
    46  golang.org/x/net/dns/dnsmessage
    47  -- $WORK/goroot/src/vendor/modules.txt --
    48  # golang.org/x/net v0.1.0
    49  ## explicit
    50  golang.org/x/net/dns/dnsmessage
    51  -- $WORK/goroot/src/vendor/golang.org/x/net/dns/dnsmessage/dnsmessage.go --
    52  package dnsmessage
    53  -- $WORK/goroot/src/net/net.go --
    54  package net
    55  
    56  import _ "golang.org/x/net/dns/dnsmessage"
    57  

View as plain text