Skip to content

Commit

Permalink
Don’t overwrite possibly non-nil error with nil
Browse files Browse the repository at this point in the history
  • Loading branch information
tie committed Oct 1, 2020
1 parent 04bfcb1 commit f665a81
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/database/sql/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,10 @@ func (db *DB) Close() error {
}
db.stop()
if c, ok := db.connector.(io.Closer); ok {
err = c.Close()
err1 := c.Close()
if err1 != nil {
err = err1
}
}
return err
}
Expand Down

0 comments on commit f665a81

Please sign in to comment.