1
0
mirror of https://github.com/golang/go synced 2024-09-30 05:24:29 -06:00

cmd/go: search the target for patterns when -mod=vendor is set

This fixes the root cause of the bootstrap failure reported in
https://groups.google.com/d/msg/golang-dev/xcVJDj5GJ84/U0pVnUOnBwAJ.

Updates #30228

Change-Id: I9ce0898922a5aac1f61ceff30319cf88031676c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/167079
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
Bryan C. Mills 2019-03-12 09:25:46 -04:00
parent 781da44091
commit d6891bd480
2 changed files with 12 additions and 1 deletions

View File

@ -105,7 +105,14 @@ func matchPackages(pattern string, tags map[string]bool, useStd bool, modules []
} }
if cfg.BuildMod == "vendor" { if cfg.BuildMod == "vendor" {
walkPkgs(filepath.Join(ModRoot(), "vendor"), "", false) if HasModRoot() {
modPrefix := Target.Path
if Target.Path == "std" {
modPrefix = ""
}
walkPkgs(ModRoot(), modPrefix, false)
walkPkgs(filepath.Join(ModRoot(), "vendor"), "", false)
}
return pkgs return pkgs
} }

View File

@ -25,6 +25,10 @@ env GOPROXY=off
! go list ... ! go list ...
go list -mod=vendor ... go list -mod=vendor ...
# However, it should still list packages in the main module.
go list -mod=vendor m/...
stdout m
-- go.mod -- -- go.mod --
module m module m