Skip to content

Commit

Permalink
Fix errcheck: error return value of w.closeTempFile is not checked
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Rodák <[email protected]>
  • Loading branch information
Honny1 committed Jul 8, 2024
1 parent 1205138 commit f2726b1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/ioutils/fswriters.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,13 @@ func (w *atomicFileWriter) complete(commit bool) (retErr error) {
}

defer func() {
w.closeTempFile()
err := w.closeTempFile()
if retErr != nil || w.writeErr != nil {
os.Remove(w.f.Name())
}
if retErr == nil {
retErr = err
}
}()

if commit {
Expand Down

0 comments on commit f2726b1

Please sign in to comment.