Commit 5c114806 authored by Russ Cox's avatar Russ Cox

cmd/go: don't let ... match GOROOT/src/cmd in module mode

GOROOT/src/cmd uses GOROOT/src/cmd/vendor, which module
mode simply cannot handle.

Exposed by making ... match the standard library, which it still should.

But for now it's fine to just exclude commands.

Change-Id: I2201b94445f11239022de8a2473aa3b573f405c0
Reviewed-on: https://go-review.googlesource.com/129055
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 64205cd4
......@@ -37,6 +37,10 @@ func matchPackages(pattern string, tags map[string]bool, useStd bool, modules []
walkPkgs := func(root, importPathRoot string) {
root = filepath.Clean(root)
var cmd string
if root == cfg.GOROOTsrc {
cmd = filepath.Join(root, "cmd")
}
filepath.Walk(root, func(path string, fi os.FileInfo, err error) error {
if err != nil {
return nil
......@@ -47,6 +51,14 @@ func matchPackages(pattern string, tags map[string]bool, useStd bool, modules []
return nil
}
// GOROOT/src/cmd makes use of GOROOT/src/cmd/vendor,
// which module mode can't deal with. Eventually we'll stop using
// that vendor directory, and then we can remove this exclusion.
// golang.org/issue/26924.
if path == cmd {
return filepath.SkipDir
}
want := true
// Avoid .foo, _foo, and testdata directory trees.
_, elem := filepath.Split(path)
......
......@@ -15,6 +15,7 @@ stdout '^unsafe$'
! stdout index/suffixarray
# 'go list ...' should list packages in all active modules and the standard library.
# But not cmd/* - see golang.org/issue/26924.
go list ...
stdout example.com/unused/useerrors
stdout example.com/m/useunsafe
......@@ -23,6 +24,7 @@ stdout example.com/m/useunsafe
stdout '^unicode$'
stdout '^unsafe$'
stdout index/suffixarray
! stdout cmd/pprof
# 'go list example.com/m/...' should list packages in all modules that begin with
# "example.com/m/".
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment