Skip to content

Commit

Permalink
Remove redundant defer
Browse files Browse the repository at this point in the history
the `Rename` already does the cleanup
  • Loading branch information
0sewa0 committed Feb 12, 2025
1 parent 0d1d2d5 commit 079a5f8
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions pkg/move/atomic.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ func atomic(copy copyFunc) copyFunc {

return err
}
defer func(){
// first remove is there for safety in case of unexpected error, this for the proper cleanup
_ = fs.RemoveAll(workFolder)
}()

err = fs.MkdirAll(workFolder, os.ModePerm)
if err != nil {
Expand All @@ -29,13 +25,6 @@ func atomic(copy copyFunc) copyFunc {
return err
}

defer func() {
err := fs.RemoveAll(workFolder)
if err != nil {
logrus.Errorf("Failed to do cleanup after run: %v", err)
}
}()

err = copy(fs, from, workFolder)
if err != nil {
logrus.Errorf("Error copying folder: %v", err)
Expand Down

0 comments on commit 079a5f8

Please sign in to comment.