Fix for gosec rule G104 - handle errors

This commit is contained in:
Monica Debbeler
2021-07-07 13:50:04 +10:00
committed by Mike Farah
parent 6658a93e7d
commit f67a83a5bc
4 changed files with 11 additions and 5 deletions
+4 -1
View File
@@ -54,6 +54,9 @@ func (w *writeInPlaceHandlerImpl) FinishWriteInPlace(evaluatedSuccessfully bool)
safelyRenameFile(w.tempFile.Name(), w.inputFilename)
} else {
log.Debug("removed temp file")
os.Remove(w.tempFile.Name())
removeErr := os.Remove(w.tempFile.Name())
if removeErr != nil {
log.Errorf("failed removing temp file: %s", w.tempFile.Name())
}
}
}