aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/search/search.go
diff options
context:
space:
mode:
authorLeonardo Comelli <leonardo.comelli@gmail.com>2019-03-19 03:53:04 +0000
committerBryan C. Mills <bcmills@google.com>2019-03-28 21:59:51 +0000
commitfa5dbd06e57475a6b788ebf0468c132ec9cd77fc (patch)
tree7921f8da175ea05b35af7cc244dc2387cd760b09 /src/cmd/go/internal/search/search.go
parent93af67783796a48b3f59bd969dc0c528c37571ec (diff)
downloadgo-fa5dbd06e57475a6b788ebf0468c132ec9cd77fc.tar.gz
go-fa5dbd06e57475a6b788ebf0468c132ec9cd77fc.zip
cmd: ignore the directory named go.mod
The existing implementation does not check in all cases whether go.mod is a regular file. Fixes #30788 Change-Id: I6d140545c3cfada651612efd5bee2fbdcb747ca7 GitHub-Last-Rev: 4a9b251e378d9d7cc8768d395c360d3542fc9bc6 GitHub-Pull-Request: golang/go#30830 Reviewed-on: https://go-review.googlesource.com/c/go/+/167393 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/search/search.go')
-rw-r--r--src/cmd/go/internal/search/search.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/internal/search/search.go b/src/cmd/go/internal/search/search.go
index 0ca60e7349..20e8f0ad1e 100644
--- a/src/cmd/go/internal/search/search.go
+++ b/src/cmd/go/internal/search/search.go
@@ -190,7 +190,7 @@ func MatchPackagesInFS(pattern string) *Match {
if !top && cfg.ModulesEnabled {
// Ignore other modules found in subdirectories.
- if _, err := os.Stat(filepath.Join(path, "go.mod")); err == nil {
+ if fi, err := os.Stat(filepath.Join(path, "go.mod")); err == nil && !fi.IsDir() {
return filepath.SkipDir
}
}