sqlclosecheck icon indicating copy to clipboard operation
sqlclosecheck copied to clipboard

Linter that confirms DB rows and statements are closed properly.

Results 21 sqlclosecheck issues
Sort by recently updated
recently updated
newest added

Because, quoting documentation, "The statements prepared for a transaction by calling the transaction's Prepare or Stmt methods are closed by the call to Commit or Rollback.". https://pkg.go.dev/database/sql#Tx Linter should avoid...

bug

The sql.Row structs returned by the QueryRow methods contain a reference to a sql.Rows instance that is only closed when Scan is called. (see https://cs.opensource.google/go/go/+/refs/tags/go1.17.3:src/database/sql/sql.go;l=3326) Thus i think that this...

enhancement
good first issue

sqlclosecheck doesn't work correctly in this case. #20 - a concrete test case. Maybe this approach of dealing with Stmt is not good, but we have some small go scripts...

bug

I meet the case that someone write ```go if err := conn.QueryRow(query, args...).Error(); err != nil { } ``` the conn leaks. In fact, he wants to Exec(query, args...). I...

enhancement

Hi, this is my first contribution and I hope I did this right, please let me know if I missed anything. When closing a connection/statement/row set I use defer blocks...

This PR fixes panic in tests when running with Go 1.23. Details ``` $ go test ./... ? github.com/ryanrolds/sqlclosecheck [no test files] ? github.com/ryanrolds/sqlclosecheck/tools [no test files] panic: runtime error:...

Hey, I see CVE-2024-27304 has been fixed in #41, but there hasn't been a tag or release for it. Can you create a new tag? Thanks a lot!

``` func deferRows(rows *sql.Rows) { err := rows.Close() if err != nil { log.Error(err) } } rows, err := db.QueryContext(ctx, "some query", arg1, arg2) if err != nil { ......