Skip to content

Commit 999c77d

Browse files
committed
godoc: don't show testdata directories
R=golang-dev, bradfitz, dsymonds, minux.ma, rsc CC=golang-dev https://golang.org/cl/5700043
1 parent 3a6a1f9 commit 999c77d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/cmd/godoc/dirtrees.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ import (
1717
"strings"
1818
)
1919

20+
// Conventional name for directories containing test data.
21+
// Excluded from directory trees.
22+
//
23+
const testdataDirName = "testdata"
24+
2025
type Directory struct {
2126
Depth int
2227
Path string // includes Name
@@ -49,7 +54,7 @@ type treeBuilder struct {
4954
}
5055

5156
func (b *treeBuilder) newDirTree(fset *token.FileSet, path, name string, depth int) *Directory {
52-
if b.pathFilter != nil && !b.pathFilter(path) {
57+
if b.pathFilter != nil && !b.pathFilter(path) || name == testdataDirName {
5358
return nil
5459
}
5560

0 commit comments

Comments
 (0)