We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version: v0.5.1
v0.5.1
Repro steps:
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() rows, err := db.Queryx("SELECT * FROM users") if err != nil { log.Print(err) return } defer rows.Close() }
Result (from golangci-lint):
golangci-lint
example_test.go:17:24: Rows/Stmt/NamedStmt was not closed (sqlclosecheck) rows, err := db.Queryx("SELECT * FROM users")
The text was updated successfully, but these errors were encountered:
➕1
we're facing the same issue in our workflows
Sorry, something went wrong.
Thank you for the report. I will take a look at this over the next few days.
How's it looking with this one? 🙏🏽
+1 in my project following code worked as a solution:
rows, err := db.Queryx("SELECT * FROM users") if err != nil { log.Print(err) return } defer func() { _ = rows.Close() }()
also worth mentioning: when I used sql instead of sqlx, there was no error
No branches or pull requests
Version:
v0.5.1
Repro steps:
Result (from
golangci-lint
):example_test.go:17:24: Rows/Stmt/NamedStmt was not closed (sqlclosecheck) rows, err := db.Queryx("SELECT * FROM users")
The text was updated successfully, but these errors were encountered: