Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Walk ¶
func Walk(root string, c WalkConfig, walkFn func(path string, info os.FileInfo, err error) error) error
Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, given the contents of WalkConfig. All errors that arise visiting files and directories are filtered by walkFn. The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient. Walk does not follow symbolic links.
Types ¶
type WalkConfig ¶
type WalkConfig struct { // Dirs controls whether to call walkFn for directories Dirs bool // Files controls whether to call walkFn for files Files bool // Extensions is a whitelist to filter files (not dirs) by, meaning that // walkFn is only called for the given extensions. When Extensions is empty, // nothing is filtered. Extensions []string // Whether to recurse through directories Recursive bool // Root controls whether to call walkFn for the root directory Root bool }
WalkConfig controls when walkFn is called by Walk.
Click to show internal directories.
Click to hide internal directories.