Skip to content

Commit a9eaf3f

Browse files
committed
🐛 fix golangci-lint handle return err
1 parent 92247d1 commit a9eaf3f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/connection-pool-sample/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ func main() {
3232
if err != nil {
3333
log.Fatalf("Error starting transaction: %v", err)
3434
}
35-
defer tx.Rollback(context.Background())
35+
defer func() {
36+
err := tx.Rollback(context.Background())
37+
if err != nil {
38+
log.Fatal(err)
39+
}
40+
}()
3641

3742
_, err = tx.Exec(context.Background(), `
3843
INSERT INTO authors (name, email)

0 commit comments

Comments
 (0)