package gopathwalk
import "cuelang.org/go/internal/golangorgx/tools/gopathwalk"
Package gopathwalk is like filepath.Walk but specialized for finding Go packages, particularly in $GOPATH and $GOROOT.
Index ¶
- func Walk(roots []Root, add func(root Root, dir string), opts Options)
- func WalkSkip(roots []Root, add func(root Root, dir string), skip func(root Root, dir string) bool, opts Options)
- type Options
- type Root
- type RootType
Functions ¶
func Walk ¶
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 WalkSkip ¶
func WalkSkip(roots []Root, add func(root Root, dir string), skip func(root Root, dir string) bool, 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).
Types ¶
type Options ¶
type Options struct { // If Logf is non-nil, debug logging is enabled through this function. Logf func(format string, args ...interface{}) // Search module caches. Also disables legacy goimports ignore rules. ModulesEnabled bool // Maximum number of concurrent calls to user-provided callbacks, // or 0 for GOMAXPROCS. Concurrency int }
Options controls the behavior of a Walk call.
type Root ¶
A Root is a starting point for a Walk.
type RootType ¶
type RootType int
RootType indicates the type of a Root.
const ( RootUnknown RootType = iota RootGOROOT RootGOPATH RootCurrentModule RootModuleCache RootOther )
Source Files ¶
walk.go
- Version
- v0.12.0 (latest)
- Published
- Jan 30, 2025
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 8 hours ago –
Tools for package owners.