diff options
author | Ray Wu <ray@liftoff.io> | 2021-04-20 10:41:37 -0700 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2021-04-27 18:17:01 +0000 |
commit | bd2175e1b1369bce59cdceb9282c817802a87746 (patch) | |
tree | 414e6f921ab24b48f891d1351b2b50dc8e0147a3 /src/cmd/go/internal/modload/search.go | |
parent | 222101549a1b0d9810e2069f776c92b6807a739d (diff) | |
download | go-bd2175e1b1369bce59cdceb9282c817802a87746.tar.gz go-bd2175e1b1369bce59cdceb9282c817802a87746.zip |
cmd/go: show warnings about symlinks only for patterns containing ...
Go commands show a warning message any time a pattern is expanded and a
symlink to a directory is encountered. For monorepo with non Go projects
using symlinks underneath, the output of go commands could be spammed by
this warning.
This commit includes the behavior change to only print this warning when
there's a pattern containing ... .
Fixes #35941
Change-Id: I094da2628bcd47b86fee8c6529d1066aa013a43b
Reviewed-on: https://go-review.googlesource.com/c/go/+/311890
Run-TryBot: Caleb Spare <cespare@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Trust: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'src/cmd/go/internal/modload/search.go')
-rw-r--r-- | src/cmd/go/internal/modload/search.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modload/search.go b/src/cmd/go/internal/modload/search.go index c34f745a24..658fc6f55a 100644 --- a/src/cmd/go/internal/modload/search.go +++ b/src/cmd/go/internal/modload/search.go @@ -86,7 +86,7 @@ func matchPackages(ctx context.Context, m *search.Match, tags map[string]bool, f } if !fi.IsDir() { - if fi.Mode()&fs.ModeSymlink != 0 && want { + if fi.Mode()&fs.ModeSymlink != 0 && want && strings.Contains(m.Pattern(), "...") { if target, err := fsys.Stat(path); err == nil && target.IsDir() { fmt.Fprintf(os.Stderr, "warning: ignoring symlink %s\n", path) } |