]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/go/internal/modload/search.go
cmd/go/internal/modload: omit return at the end of matchPackages
[gostls13.git] / src / cmd / go / internal / modload / search.go
index 627f91f09c11804e37342a819d79426c45644c1f..d392b5bf3dd9780ec02e2d0a8d96adff7e7254c5 100644 (file)
@@ -19,6 +19,7 @@ import (
 
        "cmd/go/internal/cfg"
        "cmd/go/internal/fsys"
+       "cmd/go/internal/gover"
        "cmd/go/internal/imports"
        "cmd/go/internal/modindex"
        "cmd/go/internal/par"
@@ -163,16 +164,19 @@ func matchPackages(ctx context.Context, m *search.Match, tags map[string]bool, f
        }
 
        if cfg.BuildMod == "vendor" {
-               mod := MainModules.mustGetSingleMainModule()
-               if modRoot := MainModules.ModRoot(mod); modRoot != "" {
-                       walkPkgs(modRoot, MainModules.PathPrefix(mod), pruneGoMod|pruneVendor)
-                       walkPkgs(filepath.Join(modRoot, "vendor"), "", pruneVendor)
+               for _, mod := range MainModules.Versions() {
+                       if modRoot := MainModules.ModRoot(mod); modRoot != "" {
+                               walkPkgs(modRoot, MainModules.PathPrefix(mod), pruneGoMod|pruneVendor)
+                       }
+               }
+               if HasModRoot() {
+                       walkPkgs(VendorDir(), "", pruneVendor)
                }
                return
        }
 
        for _, mod := range modules {
-               if !treeCanMatch(mod.Path) {
+               if gover.IsToolchain(mod.Path) || !treeCanMatch(mod.Path) {
                        continue
                }
 
@@ -209,8 +213,6 @@ func matchPackages(ctx context.Context, m *search.Match, tags map[string]bool, f
                }
                walkPkgs(root, modPrefix, prune)
        }
-
-       return
 }
 
 // walkFromIndex matches packages in a module using the module index. modroot