-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: ignore build tags when 'go get' modifies build list
In module mode, 'go get' should not consider build constraints when loading packages in order to modify the module graph. With this change, 'go get' considers all build tags to be true except for "ignore" and malformed build constraint expressions. When 'go get' builds packages, it still applies build constraints for the target platform. Fixes #32345 Change-Id: I6dceae6f10a5185870537de730b36292271ad124 Reviewed-on: https://go-review.googlesource.com/c/go/+/179898 Reviewed-by: Bryan C. Mills <bcmills@google.com>
- Loading branch information
Jay Conrod
committed
May 31, 2019
1 parent
64c134f
commit 6f7542e
Showing
6 changed files
with
94 additions
and
32 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,44 @@ | ||
env GO111MODULE=on | ||
|
||
[short] skip | ||
|
||
# get should add modules needed to build packages, even if those | ||
# dependencies are in sources excluded by build tags. | ||
# All build tags are considered true except "ignore". | ||
go mod init m | ||
go get -d . | ||
go list -m all | ||
stdout 'example.com/version v1.1.0' | ||
stdout 'rsc.io/quote v1.5.2' | ||
|
||
[short] skip | ||
|
||
# Packages that are only imported in excluded files should not be built. | ||
go get -x . | ||
stderr 'compile.* -p m ' | ||
! stderr 'compile.* -p example.com/version ' | ||
! stderr 'compile.* -p rsc.io/quote ' | ||
|
||
-- empty.go -- | ||
package m | ||
|
||
-- excluded.go -- | ||
// +build windows,mips | ||
|
||
package m | ||
|
||
import _ "example.com/version" | ||
|
||
-- tools.go -- | ||
// +build tools | ||
|
||
package tools | ||
|
||
import _ "rsc.io/quote" | ||
|
||
-- ignore.go -- | ||
// +build ignore | ||
|
||
package ignore | ||
|
||
import _ "example.com/doesnotexist" |