diff --git a/src/cmd/godoc/dirtrees.go b/src/cmd/godoc/dirtrees.go index b395f6014b..703c46272f 100644 --- a/src/cmd/godoc/dirtrees.go +++ b/src/cmd/godoc/dirtrees.go @@ -17,6 +17,11 @@ import ( "strings" ) +// Conventional name for directories containing test data. +// Excluded from directory trees. +// +const testdataDirName = "testdata" + type Directory struct { Depth int Path string // includes Name @@ -49,7 +54,7 @@ type treeBuilder struct { } func (b *treeBuilder) newDirTree(fset *token.FileSet, path, name string, depth int) *Directory { - if b.pathFilter != nil && !b.pathFilter(path) { + if b.pathFilter != nil && !b.pathFilter(path) || name == testdataDirName { return nil }