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 # Control case: net, viewed from outside the 'std' module,
6 # should depend on vendor/golang.org/… instead of golang.org/….
7
8 go list -deps net
9 stdout '^vendor/golang.org/x/net'
10 ! stdout '^golang.org/x/net'
11 cp stdout $WORK/net-deps.txt
12
13
14 # It should still report the same package dependencies when viewed from
15 # within GOROOT/src.
16
17 cd $GOROOT/src
18
19 go list -deps net
20 stdout '^vendor/golang.org/x/net'
21 ! stdout '^golang.org/x/net'
22 cmp stdout $WORK/net-deps.txt
23
24
25 # However, 'go mod' and 'go get' subcommands should report the original module
26 # dependencies, not the vendored packages.
27
28 [!net:golang.org] stop
29
30 env GOPROXY=
31 env GOWORK=off
32 go mod why -m golang.org/x/net
33 stdout '^# golang.org/x/net\nnet\ngolang.org/x/net'
34
View as plain text