type Options … type RootType … const RootUnknown … const RootGOROOT … const RootGOPATH … const RootCurrentModule … const RootModuleCache … const RootOther … type Root … // Walk concurrently walks Go source directories ($GOROOT, $GOPATH, etc) to find packages. // // For each package found, add will be called with the absolute // paths of the containing source directory and the package directory. // // Unlike filepath.WalkDir, Walk follows symbolic links // (while guarding against cycles). func Walk(roots []Root, add func(root Root, dir string), opts Options) { … } // WalkSkip concurrently walks Go source directories ($GOROOT, $GOPATH, etc) to // find packages. // // For each package found, add will be called with the absolute // paths of the containing source directory and the package directory. // For each directory that will be scanned, skip will be called // with the absolute paths of the containing source directory and the directory. // If skip returns false on a directory it will be processed. // // Unlike filepath.WalkDir, WalkSkip follows symbolic links // (while guarding against cycles). func WalkSkip(roots []Root, add func(root Root, dir string), skip func(root Root, dir string) bool, opts Options) { … } // walkDir creates a walker and starts fastwalk with this walker. func walkDir(root Root, add func(Root, string), skip func(root Root, dir string) bool, opts Options) { … } type walker … type symlinkList … // init initializes the walker based on its Options func (w *walker) init() { … } // getIgnoredDirs reads an optional config file at <path>/.goimportsignore // of relative directories to ignore when scanning for go files. // The provided path is one of the $GOPATH entries with "src" appended. func (w *walker) getIgnoredDirs(path string) []string { … } // shouldSkipDir reports whether the file should be skipped or not. func (w *walker) shouldSkipDir(dir string) bool { … } // walk walks through the given path. // // Errors are logged if w.opts.Logf is non-nil, but otherwise ignored. func (w *walker) walk(path string, pathSymlinks *symlinkList, d fs.DirEntry) { … }