Fix error handling in SymbolicWalk
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 25 Mar 2016 17:18:39 +0000 (18:18 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 25 Mar 2016 17:18:39 +0000 (18:18 +0100)
helpers/path.go

index 5f1e83398bc782024f00279dbb1e9565b03b8022..a5b176568e6ba246f0d0bc6a7b14b8ece89c6e41 100644 (file)
@@ -453,14 +453,14 @@ func SymbolicWalk(fs afero.Fs, root string, walker filepath.WalkFunc) error {
        // Handle the root first
        fileInfo, err := lstatIfOs(fs, root)
 
-       if err != nil || !fileInfo.IsDir() {
-               return nil
-       }
-
        if err != nil {
                return walker(root, nil, err)
        }
 
+       if !fileInfo.IsDir() {
+               return nil
+       }
+
        if err := walker(root, fileInfo, err); err != nil && err != filepath.SkipDir {
                return err
        }