return no error if file doesn't exist

This commit is contained in:
Christoph Armster 2022-02-22 09:06:46 +01:00
parent 450b30f2bf
commit e08384e901
1 changed files with 5 additions and 0 deletions

View File

@ -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)
} }