const testdataDirName … type Directory … func isGoFile(fi os.FileInfo) bool { … } func isPkgFile(fi os.FileInfo) bool { … } func isPkgDir(fi os.FileInfo) bool { … } type treeBuilder … var ioGate … var workGate … func (b *treeBuilder) newDirTree(fset *token.FileSet, path, name string, depth int) *Directory { … } // newDirectory creates a new package directory tree with at most maxDepth // levels, anchored at root. The result tree is pruned such that it only // contains directories that contain package files or that contain // subdirectories containing package files (transitively). If a non-nil // pathFilter is provided, directory paths additionally must be accepted // by the filter (i.e., pathFilter(path) must be true). If a value >= 0 is // provided for maxDepth, nodes at larger depths are pruned as well; they // are assumed to contain package files even if their contents are not known // (i.e., in this case the tree may contain directories w/o any package files). func (c *Corpus) newDirectory(root string, maxDepth int) *Directory { … } func (dir *Directory) walk(c chan<- *Directory, skipRoot bool) { … } func (dir *Directory) iter(skipRoot bool) <-chan *Directory { … } func (dir *Directory) lookupLocal(name string) *Directory { … } func splitPath(p string) []string { … } // lookup looks for the *Directory for a given path, relative to dir. func (dir *Directory) lookup(path string) *Directory { … } type DirEntry … type DirList … // hasThirdParty checks whether a list of directory entries has packages outside // the standard library or not. func hasThirdParty(list []DirEntry) bool { … } // listing creates a (linear) directory listing from a directory tree. // If skipRoot is set, the root directory itself is excluded from the list. // If filter is set, only the directory entries whose paths match the filter // are included. func (dir *Directory) listing(skipRoot bool, filter func(string) bool) *DirList { … }