sqlclosecheck icon indicating copy to clipboard operation
sqlclosecheck copied to clipboard

Linter that confirms DB rows and statements are closed properly.

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

Version: `v0.5.1` Repro steps: ```go package bug_test import ( "log" "github.com/jmoiron/sqlx" ) func Example() { db, err := sqlx.Open("pgx", "postgres://localhost/db") if err != nil { log.Print(err) return } defer db.Close()...

bug

Pgx apparently closes rows when all rows are read and I guess because of this defer seems not needed. But this shouldn't be the case since function might stop before...

Work to resolve https://github.com/ryanrolds/sqlclosecheck/pull/20

When using db.Query(query) the Rows/Stmt was not closed error appears, even though I'm checking the Err() method. The documentation says that Close() is called automatically and checking of Err() is...

enhancement

Prepared statements can live as long as the connection and be reused over and over and then closed much later. In that scenario, it would be nice to be able...

bug

I would like to be able call a function to close my sqlx.Stmt structs to reduce dublicate code using a function like: ``` func closer(aStruct io.Closer) { err := aStruct.Close()...

bug
help wanted

Hello, and thanks for the linter. sqlclosecheck complains that `rows.Close()` should use defer. Can you explain **why** this is? For example, I don't see a difference between: ``` rows :=...

bug
help wanted

[from the godocs for Tx.StmtContext](https://golang.org/pkg/database/sql/#Tx.StmtContext): > The returned statement operates within the transaction and will be closed when the transaction has been committed or rolled back. This makes it syntactically...

bug
help wanted

Thank you for the tool. Here's a repro of an issue I encountered. Expected: The linter warns me that I never closed this `rows` Actual: Not detected ``` package sqlx_examples...

bug