go/buildutil: use same logic as 'go' tool for pruning package search.
The previous logic would descend into (e.g.) .git repositories and vendored packages with "_"-prefixed names. Fixes golang/go#8907 LGTM=gri R=gri CC=golang-codereviews, shurcool https://golang.org/cl/157800043
This commit is contained in:
parent
efd8523ea7
commit
b45b275b99
|
|
@ -77,9 +77,9 @@ func allPackages(ctxt *build.Context, sema chan bool, root string, found func(st
|
||||||
|
|
||||||
var walkDir func(dir string)
|
var walkDir func(dir string)
|
||||||
walkDir = func(dir string) {
|
walkDir = func(dir string) {
|
||||||
// Prune search if we encounter any directory with these base names:
|
// Avoid .foo, _foo, and testdata directory trees.
|
||||||
switch filepath.Base(dir) {
|
base := filepath.Base(dir)
|
||||||
case "testdata", ".hg":
|
if base == "" || base[0] == '.' || base[0] == '_' || base == "testdata" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue