lint: add sqlclosecheck (#8129)

Picking up from #7709
This commit is contained in:
Jacob Hoffman-Andrews 2025-04-21 11:01:37 -07:00 committed by GitHub
parent e8eddc0d50
commit 37147d4dfa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 1 deletions

View File

@ -9,6 +9,7 @@ linters:
- ineffassign - ineffassign
- misspell - misspell
- nolintlint - nolintlint
- sqlclosecheck
- typecheck - typecheck
- unconvert - unconvert
- unparam - unparam

View File

@ -131,7 +131,7 @@ func (c contactAuditor) run(ctx context.Context, resChan chan *result) error {
} }
} }
// Ensure the query wasn't interrupted before it could complete. // Ensure the query wasn't interrupted before it could complete.
err = rows.Close() err = rows.Close() //nolint:sqlclosecheck // the lint wants us to do this in a defer instead, but we want to return the error
if err != nil { if err != nil {
return err return err
} else { } else {

View File

@ -113,6 +113,7 @@ func allTableNamesInDB(ctx context.Context, db CleanUpDB) ([]string, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer r.Close()
var ts []string var ts []string
for r.Next() { for r.Next() {
tableName := "" tableName := ""