-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
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
SSA and generics (go1.18) #24
Comments
Updating Update golang.org/x/tools to the newest version is not enough. |
@ldez I did. |
what I can say: in golangci-lint, this update is not enough to fix the problem of this linter. There are several syntaxes to validate for the support of generics. |
@ldez could you provide a codesnippet for that rowserrcheck fails? |
SSA has been updated and it seems to work inside golangci-lint. |
in fact, the problem is still here |
@ldez what is the problem? How can I reproduce the problem only with rowserrcheck? |
import (
"database/sql"
)
func RowsErrNotChecked(db *sql.DB, a int) {
rows, _ := db.Query("select id from tb")
for rows.Next() {
}
}
func RowsErrNotCheckedG[T ~int64](db *sql.DB, a T) {
rows, _ := db.Query("select id from tb")
for rows.Next() {
}
} |
@ldez I can't reproduce an issue with that snippet. [fho@ltop rowserrcheck]$ git rev-parse HEAD
fa9179529ab817c3359a4f5beeec91546f71d602
[fho@ltop rowserrcheck]$ cat /tmp/main.go
package main
import (
"database/sql"
)
func RowsErrNotChecked(db *sql.DB, a int) {
rows, _ := db.Query("select id from tb")
for rows.Next() {
}
}
func RowsErrNotCheckedG[T ~int64](db *sql.DB, a T) {
rows, _ := db.Query("select id from tb")
for rows.Next() {
}
}
[fho@ltop rowserrcheck]$ go run main.go -- /tmp/main.go
/tmp/main.go:8:21: rows.Err must be checked
exit status 3 |
With the sample, you must have 2 reports, currently, you only have one. |
@ldez right, but this is not blocking to enable rowserrcheck in golangci-lint again, is it? |
It is blocking. False negatives are worse than false positives. |
Currently, SSA is not working with generics.
So your linter produces a panic when it is used with generics.
There is an issue open about that in the Go repository: golang/go#48525
Inside golangci-lint, we have disabled your linters: golangci/golangci-lint#2649
You have 2 solutions:
Related to golang/go#50558
The text was updated successfully, but these errors were encountered: