Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

facebookarchive/symwalk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages