mirror of https://github.com/spf13/afero.git
Fix the infinite recursion by skipping the current directory in the directory names listing
This commit is contained in:
parent
5c4385aa20
commit
c689108954
4
path.go
4
path.go
|
@ -59,6 +59,10 @@ func walk(fs Fs, path string, info os.FileInfo, walkFn filepath.WalkFunc) error
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, name := range names {
|
for _, name := range names {
|
||||||
|
if name == path {
|
||||||
|
// skip current directory to avoid infinite recursion
|
||||||
|
continue
|
||||||
|
}
|
||||||
filename := filepath.Join(path, name)
|
filename := filepath.Join(path, name)
|
||||||
fileInfo, err := lstatIfPossible(fs, filename)
|
fileInfo, err := lstatIfPossible(fs, filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue