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
unused: warning about unexported struct that is used only as explicit generic parameter to function in another package #1282
Comments
I can reproduce the issue. Interestingly, the bug only occurs if Will investigate. |
This is one in a series of bugs caused by the unfortunate implementation of |
This also seems to be a problem with a local type alias. In the original example if we add package bar
import "utils"
func Use() { //@ used(true)
type s = utils.S //@ used(true)
println(utils.TypeOfType[s]().String())
} That is, I'm assuming these all share the root cause, but I can make a full report if it would help. |
No need. It's probably a different root cause, but also addressed by the (still in progress…) rewrite. |
Hi the following code snippet gives a warning (type EmptyStruct is unused (U1000)go-staticcheck
View Problem), when it should not (probably related to #1250 ):
I have an internal(i.e. under /internal/utils.go) package utils with a function TypeOfType taking a generic parameter
Then in some other package I do:
Staticcheck complains about EmptyStruct being unused, when it is clearly not. This persists even if the returned value of utils.TypeOfType is actually used (The example above is just simplified) or being defined at global scope, but unexported.
Note that the issue only happens if TypeOfType is defined in another package.
I use MS Code, version is
go: /snap/go/current/bin/go: go version go1.18.2 linux/amd64
Best,
Gottfried
The text was updated successfully, but these errors were encountered: