aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modcmd/vendor.go
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2019-05-31 14:14:00 -0400
committerJay Conrod <jayconrod@google.com>2019-05-31 23:00:43 +0000
commit6f7542e4cb6914e8b8d888f16d440feeb8e631d2 (patch)
treeedb490d9208d53c74270f2371e563353c76f168d /src/cmd/go/internal/modcmd/vendor.go
parent64c134f90f0cf6d0e55fca93c433b68810d12f12 (diff)
downloadgo-6f7542e4cb6914e8b8d888f16d440feeb8e631d2.tar.gz
go-6f7542e4cb6914e8b8d888f16d440feeb8e631d2.zip
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>
Diffstat (limited to 'src/cmd/go/internal/modcmd/vendor.go')
-rw-r--r--src/cmd/go/internal/modcmd/vendor.go4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/cmd/go/internal/modcmd/vendor.go b/src/cmd/go/internal/modcmd/vendor.go
index 44cabd5dea..75513f1d9c 100644
--- a/src/cmd/go/internal/modcmd/vendor.go
+++ b/src/cmd/go/internal/modcmd/vendor.go
@@ -166,8 +166,6 @@ func matchMetadata(dir string, info os.FileInfo) bool {
return false
}
-var anyTagsExceptIgnore = map[string]bool{"*": true}
-
// matchPotentialSourceFile reports whether info may be relevant to a build operation.
func matchPotentialSourceFile(dir string, info os.FileInfo) bool {
if strings.HasSuffix(info.Name(), "_test.go") {
@@ -181,7 +179,7 @@ func matchPotentialSourceFile(dir string, info os.FileInfo) bool {
defer f.Close()
content, err := imports.ReadImports(f, false, nil)
- if err == nil && !imports.ShouldBuild(content, anyTagsExceptIgnore) {
+ if err == nil && !imports.ShouldBuild(content, imports.AnyTags()) {
// The file is explicitly tagged "ignore", so it can't affect the build.
// Leave it out.
return false