Skip to content

Commit

Permalink
error handling in os.Rename error block
Browse files Browse the repository at this point in the history
  • Loading branch information
sho-hata committed Oct 28, 2024
1 parent babb5ba commit c66a127
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tparagen.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ func (t *tparagen) run() error {

if err := os.Rename(tmpPath, origPath); err != nil {
// TODO: logging
t.errStream.Write([]byte(fmt.Sprintf("failed to rename %s to %s. %v\n", tmpPath, origPath, err)))
if _, err := t.errStream.Write([]byte(fmt.Sprintf("failed to rename %s to %s. %v\n", tmpPath, origPath, err))); err != nil {
return false
}
}

return true
Expand Down

0 comments on commit c66a127

Please sign in to comment.