Skip to content

Commit e0768be

Browse files
mcuadrostjamet
authored andcommitted
utils: Walk, minor style changes
1 parent 999b447 commit e0768be

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

util/walk.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,27 @@ func walk(fs billy.Filesystem, path string, info os.FileInfo, walkFn filepath.Wa
4646
return nil
4747
}
4848

49-
// Walk walks the file tree rooted at root, calling fn for each file or directory in the tree, including root.
49+
// Walk walks the file tree rooted at root, calling fn for each file or
50+
// directory in the tree, including root. All errors that arise visiting files
51+
// and directories are filtered by fn: see the WalkFunc documentation for
52+
// details.
5053
//
51-
// All errors that arise visiting files and directories are filtered by fn: see the WalkFunc documentation for details.
52-
//
53-
// The files are walked in lexical order, which makes the output deterministic but requires Walk to read an entire directory into memory before proceeding to walk that directory.
54-
//
55-
// Walk does not follow symbolic links.
56-
//
57-
// adapted from https://github.com/golang/go/blob/3b770f2ccb1fa6fecc22ea822a19447b10b70c5c/src/path/filepath/path.go#L500
54+
// The files are walked in lexical order, which makes the output deterministic
55+
// but requires Walk to read an entire directory into memory before proceeding
56+
// to walk that directory. Walk does not follow symbolic links.
57+
//
58+
// Function adapted from https://github.com/golang/go/blob/3b770f2ccb1fa6fecc22ea822a19447b10b70c5c/src/path/filepath/path.go#L500
5859
func Walk(fs billy.Filesystem, root string, walkFn filepath.WalkFunc) error {
5960
info, err := fs.Lstat(root)
60-
6161
if err != nil {
6262
err = walkFn(root, nil, err)
6363
} else {
6464
err = walk(fs, root, info, walkFn)
6565
}
66+
6667
if err == filepath.SkipDir {
6768
return nil
6869
}
70+
6971
return err
7072
}

0 commit comments

Comments
 (0)