walk

package
v0.0.0-...-4094104 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2019 License: MIT Imports: 7 Imported by: 0

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 Walk, similar to filepath.SkipDir.

Functions

func Walk

func Walk(root string, walkFn WalkFn) error

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

If Walk 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.
  • Walk can follow symlinks if walkFn returns the TraverseLink sentinel error. It is the walkFn's responsibility to prevent Walk from going into symlink cycles.

func WalkRoots

func WalkRoots(roots []string, walkFn WalkFn) error

Types

type WalkFn

type WalkFn func(path string, typ os.FileMode, rc io.ReadCloser) error

Jump to

Keyboard shortcuts

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