cmd/go/internal/vgo: fix vendor for packages limited to a single tag The "all tags are valid" logic wasn't being push all the way down, leading to spurious "no Go source files" errors. Fixes golang/go#25871. Change-Id: I0afd91d9458ccdb3440949d5c53268ffd3a3aa82 Reviewed-on: https://go-review.googlesource.com/118956 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Ross Light <light@google.com>
diff --git a/vendor/cmd/go/internal/vgo/load.go b/vendor/cmd/go/internal/vgo/load.go index fee3ff0..d650bf2 100644 --- a/vendor/cmd/go/internal/vgo/load.go +++ b/vendor/cmd/go/internal/vgo/load.go
@@ -80,8 +80,12 @@ case "test", "vet": level = levelTest } + isALL := len(args) == 1 && args[0] == "ALL" cleaned := search.CleanImportPaths(args) iterate(func(ld *loader) { + if isALL { + ld.tags = map[string]bool{"*": true} + } args = expandImportPaths(cleaned) for i, pkg := range args { if pkg == "." || pkg == ".." || strings.HasPrefix(pkg, "./") || strings.HasPrefix(pkg, "../") {
diff --git a/vendor/cmd/go/testdata/vendormod/v4.go b/vendor/cmd/go/testdata/vendormod/v4.go new file mode 100644 index 0000000..2ae3980 --- /dev/null +++ b/vendor/cmd/go/testdata/vendormod/v4.go
@@ -0,0 +1,5 @@ +// +build notmytag + +package m + +import _ "x/x1"
diff --git a/vendor/cmd/go/testdata/vendormod/x/testdata/x.txt b/vendor/cmd/go/testdata/vendormod/x/testdata/x.txt new file mode 100644 index 0000000..8c51625 --- /dev/null +++ b/vendor/cmd/go/testdata/vendormod/x/testdata/x.txt
@@ -0,0 +1 @@ +placeholder - want directory with no go files
diff --git a/vendor/cmd/go/testdata/vendormod/x/x1/x1.go b/vendor/cmd/go/testdata/vendormod/x/x1/x1.go new file mode 100644 index 0000000..8244f03 --- /dev/null +++ b/vendor/cmd/go/testdata/vendormod/x/x1/x1.go
@@ -0,0 +1,3 @@ +// +build notmytag + +package x1