Add a lint check to close SQL resources (stmts and rows)
This commit is contained in:
parent
4cabae45dd
commit
7f24bb7893
@ -30,6 +30,7 @@ linters:
|
|||||||
- gofmt
|
- gofmt
|
||||||
- errorlint
|
- errorlint
|
||||||
- nolintlint
|
- nolintlint
|
||||||
|
- sqlclosecheck
|
||||||
|
|
||||||
|
|
||||||
# Useless linters:
|
# Useless linters:
|
||||||
|
@ -226,6 +226,7 @@ func (p Profile) GetTweetDetail(id TweetID) (TweetDetailView, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
defer stmt.Close()
|
||||||
|
|
||||||
// Main tweet and parents
|
// Main tweet and parents
|
||||||
var thread []Tweet
|
var thread []Tweet
|
||||||
@ -257,6 +258,7 @@ func (p Profile) GetTweetDetail(id TweetID) (TweetDetailView, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
defer stmt.Close()
|
||||||
err = stmt.Select(&replies, id)
|
err = stmt.Select(&replies, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -66,6 +66,7 @@ func (p Profile) GetSpaceById(id scraper.SpaceID) (space scraper.Space, err erro
|
|||||||
if errors.Is(err, sql.ErrNoRows) {
|
if errors.Is(err, sql.ErrNoRows) {
|
||||||
err = nil
|
err = nil
|
||||||
}
|
}
|
||||||
|
defer rows.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -213,6 +213,7 @@ func (p Profile) GetAllFollowedUsers() []scraper.UserHandle {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
|
||||||
ret := []scraper.UserHandle{}
|
ret := []scraper.UserHandle{}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user