Skip to content

Commit b075dfb

Browse files
committed
cmd/go/internal/modload: skip go.mod directories on all systems, not just Plan 9
I see no reason Plan 9 should be special cased. A directory named go.mod is not useful on any system. Followup to CL 129804. Change-Id: I9cc91b5934b17650bfdb07370aa73aeae445968c Reviewed-on: https://go-review.googlesource.com/c/149337 Run-TryBot: Russ Cox <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
1 parent 43edf21 commit b075dfb

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/cmd/go/internal/modload/init.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"path"
2626
"path/filepath"
2727
"regexp"
28-
"runtime"
2928
"strconv"
3029
"strings"
3130
)
@@ -402,7 +401,7 @@ func FindModuleRoot(dir, limit string, legacyConfigOK bool) (root, file string)
402401

403402
// Look for enclosing go.mod.
404403
for {
405-
if fi, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil && !(runtime.GOOS == "plan9" && fi.IsDir()) {
404+
if fi, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil && !fi.IsDir() {
406405
return dir, "go.mod"
407406
}
408407
if dir == limit {
@@ -420,7 +419,7 @@ func FindModuleRoot(dir, limit string, legacyConfigOK bool) (root, file string)
420419
dir = dir1
421420
for {
422421
for _, name := range altConfigs {
423-
if fi, err := os.Stat(filepath.Join(dir, name)); err == nil && !(runtime.GOOS == "plan9" && fi.IsDir()) {
422+
if fi, err := os.Stat(filepath.Join(dir, name)); err == nil && !fi.IsDir() {
424423
return dir, name
425424
}
426425
}

0 commit comments

Comments
 (0)