forked from mirror/afero
return no error if file doesn't exist
This commit is contained in:
parent
450b30f2bf
commit
e08384e901
|
@ -325,9 +325,14 @@ func (fs *Fs) RemoveAll(path string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
pathInfo, err := fs.Stat(path)
|
pathInfo, err := fs.Stat(path)
|
||||||
|
if errors.Is(err, ErrFileNotFound) {
|
||||||
|
// return early if file doesn't exist
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !pathInfo.IsDir() {
|
if !pathInfo.IsDir() {
|
||||||
return fs.Remove(path)
|
return fs.Remove(path)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue