Commit e44a0316 authored by Bryan C. Mills's avatar Bryan C. Mills

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: default avatarJay Conrod <jayconrod@google.com>
parent a563f2f4
...@@ -112,6 +112,11 @@ func matchPackages(pattern string, tags map[string]bool, useStd bool, modules [] ...@@ -112,6 +112,11 @@ func matchPackages(pattern string, tags map[string]bool, useStd bool, modules []
walkPkgs(cfg.GOROOTsrc, "") walkPkgs(cfg.GOROOTsrc, "")
} }
if cfg.BuildMod == "vendor" {
walkPkgs(filepath.Join(ModRoot(), "vendor"), "")
return pkgs
}
for _, mod := range modules { for _, mod := range modules {
if !treeCanMatch(mod.Path) { if !treeCanMatch(mod.Path) {
continue continue
......
...@@ -19,6 +19,12 @@ cmp go.mod go.mod.good ...@@ -19,6 +19,12 @@ cmp go.mod go.mod.good
go list -mod=vendor go list -mod=vendor
cmp go.mod go.mod.good 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 -- -- go.mod --
module m module m
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment