diff --git a/src/cmd/go/main.go b/src/cmd/go/main.go index 8ef6395f4f7..fdea80916f5 100644 --- a/src/cmd/go/main.go +++ b/src/cmd/go/main.go @@ -327,9 +327,9 @@ func allPackages(pattern string) []string { return nil } - // Avoid .foo and testdata directory trees. + // Avoid .foo, _foo, and testdata directory trees. _, elem := filepath.Split(path) - if strings.HasPrefix(elem, ".") || elem == "testdata" { + if strings.HasPrefix(elem, ".") || strings.HasPrefix(elem, "_") || elem == "testdata" { return filepath.SkipDir } @@ -394,9 +394,9 @@ func allPackagesInFS(pattern string) []string { return nil } - // Avoid .foo and testdata directory trees. + // Avoid .foo, _foo, and testdata directory trees. _, elem := filepath.Split(path) - if strings.HasPrefix(elem, ".") || elem == "testdata" { + if strings.HasPrefix(elem, ".") || strings.HasPrefix(elem, "_") || elem == "testdata" { return filepath.SkipDir }