...
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
8go list -deps net
9stdout '^vendor/golang.org/x/net'
10! stdout '^golang.org/x/net'
11cp stdout $WORK/net-deps.txt
12
13
14# It should still report the same package dependencies when viewed from
15# within GOROOT/src.
16
17cd $GOROOT/src
18
19go list -deps net
20stdout '^vendor/golang.org/x/net'
21! stdout '^golang.org/x/net'
22cmp 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
30env GOPROXY=
31env GOWORK=off
32go mod why -m golang.org/x/net
33stdout '^# golang.org/x/net\nnet\ngolang.org/x/net'
View as plain text