symwalk

package module
v0.0.0-...-42004b9 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2015 License: BSD-3-Clause Imports: 2 Imported by: 46

README

symwalk

    import "github.com/facebookgo/symwalk"

Package symwalk provides an implementation of symbolic link aware filepath walk.

Walk calls filepath.Walk by providing it with a special WalkFn that wraps the given WalkFn. This function calls the given WalkFn for regular files. However, when it encounters a symbolic link, it resolves the link fully using filepath.EvalSymlinks and recursively calls symwalk.Walk on the resolved path. This ensures that unlike filepath.Walk, traversal does not stop at symbolic links.

Using it can be as simple as:

    Walk(
      "/home/me/src",
      func(path string, info os.FileInfo, err error) error {
        fmt.Println(path)
        return nil
      },
    )

CAVEAT: Note that symwalk.Walk does not terminate if there are any non-terminating loops in the file structure.

Documentation

Overview

Package symwalk provides an implementation of symbolic link aware filepath walk.

filepath.Walk does not follow symbolic links. symwalk.Walk calls filepath.Walk by providing it with a special WalkFn called symWalkFunc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Walk

func Walk(path string, walkFn filepath.WalkFunc) error

Walk extends filepath.Walk to also follow symlinks

Types

This section is empty.

Jump to

Keyboard shortcuts

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