1
0
mirror of https://github.com/golang/go synced 2024-11-22 04:24:39 -07:00

cmd/go/internal/modload: use slices.Contains

Change-Id: I9d39984b6b15d415189592b592de471f50b43d0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/618495
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Tobias Klauser 2024-10-08 10:18:22 +02:00 committed by Gopher Robot
parent dd281fd616
commit 13e9a55afd

View File

@ -536,14 +536,7 @@ func matchLocalDirs(ctx context.Context, modRoots []string, m *search.Match, rs
}
modRoot := findModuleRoot(absDir)
found := false
for _, mainModuleRoot := range modRoots {
if mainModuleRoot == modRoot {
found = true
break
}
}
if !found && search.InDir(absDir, cfg.GOROOTsrc) == "" && pathInModuleCache(ctx, absDir, rs) == "" {
if !slices.Contains(modRoots, modRoot) && search.InDir(absDir, cfg.GOROOTsrc) == "" && pathInModuleCache(ctx, absDir, rs) == "" {
m.Dirs = []string{}
scope := "main module or its selected dependencies"
if inWorkspaceMode() {