-
-
Notifications
You must be signed in to change notification settings - Fork 3
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) #41
Comments
Hm, thanks for informing. wait for a new version of SSA. |
SSA has been updated and it seems to work inside golangci-lint. |
Thanks |
in fact, the problem is still here |
The code of the linter needs to be adapted to manage generics: func wastedassignG[T ~int](hoge T) {
var i int
for {
hoge = 5 // <- not detected KO
// break
}
println(i)
println(hoge)
return
}
func wastedassign(hoge int) {
var i int
for {
hoge = 5 // <- detected OK
// break
}
println(i)
println(hoge)
return
} |
go1.19 will come in about 2 weeks, it can be good if you can fix your linter before this release. |
Hi, everyone! Is there any movement about go1.19 release? Actually, i can't reproduce that problem with new version: main.go package main
import "fmt"
func wastedassignG[T ~int](hoge T) {
var i int
for {
i = 5
}
fmt.Println(i)
}
func wastedassign(hoge int) {
var i int
for {
i = 5
}
fmt.Println(i)
}
func main() {
} And it gives me this output:
Seems like it was fixed and golangci-lint can reenable wastedassign? |
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: