mirror of https://github.com/golang/go.git
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: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
64205cd4b6
commit
5c11480631
|
|
@ -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/".
|
||||
|
|
|
|||
Loading…
Reference in New Issue