mirror of
https://github.com/golang/go
synced 2024-11-12 09:50:21 -07:00
cmd/go/internal/modload: do not fetch modules in searchPackages if -mod=vendor is set
Updates #30228 Updates #30241 Change-Id: I6b5f842d00ba273ed241abe55a1ea71c105ec284 Reviewed-on: https://go-review.googlesource.com/c/go/+/165377 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
a563f2f417
commit
e44a031651
@ -112,6 +112,11 @@ func matchPackages(pattern string, tags map[string]bool, useStd bool, modules []
|
||||
walkPkgs(cfg.GOROOTsrc, "")
|
||||
}
|
||||
|
||||
if cfg.BuildMod == "vendor" {
|
||||
walkPkgs(filepath.Join(ModRoot(), "vendor"), "")
|
||||
return pkgs
|
||||
}
|
||||
|
||||
for _, mod := range modules {
|
||||
if !treeCanMatch(mod.Path) {
|
||||
continue
|
||||
|
@ -19,6 +19,12 @@ cmp go.mod go.mod.good
|
||||
go list -mod=vendor
|
||||
cmp go.mod go.mod.good
|
||||
|
||||
# With a clean (and empty) module cache, 'go list -mod=vendor' should not download modules.
|
||||
go clean -modcache
|
||||
env GOPROXY=off
|
||||
! go list ...
|
||||
go list -mod=vendor ...
|
||||
|
||||
-- go.mod --
|
||||
module m
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user