Skip to content

Commit

Permalink
Fixing deferring unsafe method "Close" on type "*os.File"
Browse files Browse the repository at this point in the history
  • Loading branch information
cinar committed Dec 19, 2023
1 parent c552578 commit c84107b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion helper/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,10 @@ func (r *Report) WriteToFile(fileName string) error {

defer file.Close()

return r.WriteToWriter(file)
err = r.WriteToWriter(file)
if err != nil {
return err
}

return file.Sync()
}

0 comments on commit c84107b

Please sign in to comment.