-
Notifications
You must be signed in to change notification settings - Fork 17.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: resolve std-vendored dependencies as std packages except in '…
…go get' and 'go mod' In CL 251159, I removed a hard-coded special case changing the rewriting behavior for std dependencies in GOROOT/src/vendor and GOROOT/src/cmd/vendor. Unfortunately, that caused packages in 'std' to be reported as stale when run within GOROOT/src. This change restores the special-case behavior, but plumbs it through the PackageOpts explicitly instead of comparing strings stored in global variables. Fixes #44725 Change-Id: If084fe74972ce1704715ca79b0b7e092dd90c88b Reviewed-on: https://go-review.googlesource.com/c/go/+/297869 Trust: Bryan C. Mills <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
- Loading branch information
Bryan C. Mills
committed
Mar 2, 2021
1 parent
09f4ef4
commit e9eed78
Showing
8 changed files
with
72 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# https://golang.org/issue/44725: packages in std should not be reported as stale, | ||
# regardless of whether they are listed from within or outside GOROOT/src. | ||
|
||
# Control case: net should not be stale at the start of the test, | ||
# and should depend on vendor/golang.org/… instead of golang.org/…. | ||
|
||
! stale net | ||
|
||
go list -deps net | ||
stdout '^vendor/golang.org/x/net' | ||
! stdout '^golang.org/x/net' | ||
|
||
# Net should also not be stale when viewed from within GOROOT/src, | ||
# and should still report the same package dependencies. | ||
|
||
cd $GOROOT/src | ||
! stale net | ||
|
||
go list -deps net | ||
stdout '^vendor/golang.org/x/net' | ||
! stdout '^golang.org/x/net' | ||
|
||
|
||
# However, 'go mod' and 'go get' subcommands should report the original module | ||
# dependencies, not the vendored packages. | ||
|
||
[!net] stop | ||
|
||
env GOPROXY= | ||
go mod why -m golang.org/x/net | ||
stdout '^# golang.org/x/net\nnet\ngolang.org/x/net' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters