sqlclosecheck
sqlclosecheck copied to clipboard
Check Row.Scan calls
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 linter should also look for missing Row.Scan calls which would cause the same problems as missing Rows.Close calls.
Thank you for raising this. I'm adding this to the list of improvements to make.