fastwalk

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2024 License: MIT Imports: 9 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TraverseLink = errors.New("traverse symlink, assuming target is a directory")

TraverseLink is a sentinel error for fastWalk, similar to filepath.SkipDir.

Functions

func FastWalk

func FastWalk(root string, walkFn func(path string, typ os.FileMode) error) error

FastWalk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root.

If fastWalk returns filepath.SkipDir, the directory is skipped.

Unlike filepath.Walk:

  • file stat calls must be done by the user. The only provided metadata is the file type, which does not include any permission bits.
  • multiple goroutines stat the filesystem concurrently. The provided walkFn must be safe for concurrent use.
  • fastWalk can follow symlinks if walkFn returns the TraverseLink sentinel error. It is the walkFn's responsibility to prevent fastWalk from going into symlink cycles.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL