Skip to content

Commit

Permalink
fix: close and remove file
Browse files Browse the repository at this point in the history
Signed-off-by: guangwu <[email protected]>
  • Loading branch information
testwill authored Apr 10, 2024
1 parent 7a2cdab commit 578a817
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion go/tools/codegen/goimports.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ func FormatJenFile(file *jen.File) ([]byte, error) {
if err != nil {
return nil, err
}

defer os.Remove(tempFile.Name())
defer tempFile.Close()
err = file.Save(tempFile.Name())
if err != nil {
return nil, err
Expand Down

0 comments on commit 578a817

Please sign in to comment.