go.tools/imports: use same logic as 'go' tool for pruning package search.
The previous logic would descend into "_"-prefixed names, "testdata" folders, and skipped folders beginning with a digit. Fixes golang/go#8958. LGTM=bradfitz R=golang-codereviews, dave, bradfitz CC=golang-codereviews https://golang.org/cl/167000043
This commit is contained in:
parent
c097262a24
commit
a26eca502f
|
@ -239,11 +239,9 @@ func loadPkg(wg *sync.WaitGroup, root, pkgrelpath string) {
|
|||
// then the calls to importPathToName below can be expensive.
|
||||
hasGo := false
|
||||
for _, child := range children {
|
||||
// Avoid .foo, _foo, and testdata directory trees.
|
||||
name := child.Name()
|
||||
if name == "" {
|
||||
continue
|
||||
}
|
||||
if c := name[0]; c == '.' || ('0' <= c && c <= '9') {
|
||||
if name == "" || name[0] == '.' || name[0] == '_' || name == "testdata" {
|
||||
continue
|
||||
}
|
||||
if strings.HasSuffix(name, ".go") {
|
||||
|
|
Loading…
Reference in New Issue