Skip to content

Commit

Permalink
panic if failing to close generated file
Browse files Browse the repository at this point in the history
  • Loading branch information
josephcopenhaver committed Nov 29, 2023
1 parent e321ff8 commit 57559ea
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion loadtester/internal/cmd/generate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,15 @@ func main() {
if err != nil {
panic(err)
}
defer f.Close()
defer func() {
if err := f.Close(); err != nil {
v := any(err)
if r := recover(); r != nil {
v = r
}
panic(v)
}
}()

var buf bytes.Buffer

Expand Down

0 comments on commit 57559ea

Please sign in to comment.