fix(GODT-2963): Use multi error to report file removal errors
Do not abort removing files on first error. Collect errors and try to remove as many as possible. This would cause some state files to not be removed on windows.
This commit is contained in:
parent
f4958b9b53
commit
07c03c6920
|
@ -72,11 +72,12 @@ func remove(dir string, except ...string) error {
|
|||
|
||||
sort.Sort(sort.Reverse(sort.StringSlice(toRemove)))
|
||||
|
||||
var multiErr error
|
||||
for _, target := range toRemove {
|
||||
if err := os.RemoveAll(target); err != nil {
|
||||
return err
|
||||
multiErr = multierror.Append(multiErr, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
return multiErr
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue