mirror of
https://github.com/golang/go
synced 2024-11-17 23:14:49 -07: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:
parent
781da44091
commit
d6891bd480
@ -105,7 +105,14 @@ func matchPackages(pattern string, tags map[string]bool, useStd bool, modules []
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,10 @@ env GOPROXY=off
|
||||
! go list ...
|
||||
go list -mod=vendor ...
|
||||
|
||||
# However, it should still list packages in the main module.
|
||||
go list -mod=vendor m/...
|
||||
stdout m
|
||||
|
||||
-- go.mod --
|
||||
module m
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user