diff --git a/path.go b/path.go index 18f60a0..faf5129 100644 --- a/path.go +++ b/path.go @@ -59,6 +59,10 @@ func walk(fs Fs, path string, info os.FileInfo, walkFn filepath.WalkFunc) error } for _, name := range names { + if name == path { + // skip current directory to avoid infinite recursion + continue + } filename := filepath.Join(path, name) fileInfo, err := lstatIfPossible(fs, filename) if err != nil {