mirror of
https://github.com/golang/go
synced 2024-11-18 16:04:44 -07:00
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)
|
||||
walkDir = func(dir string) {
|
||||
// Prune search if we encounter any directory with these base names:
|
||||
switch filepath.Base(dir) {
|
||||
case "testdata", ".hg":
|
||||
// Avoid .foo, _foo, and testdata directory trees.
|
||||
base := filepath.Base(dir)
|
||||
if base == "" || base[0] == '.' || base[0] == '_' || base == "testdata" {
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user