You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
unused: false positive involving unnamed struct types, named struct types and implicit conversions #810
Yes, I get the following output with staticcheck built from master on this repo:
unused_test.go:14:7: type temp is unused (U1000)
Run './staticcheck -explain <check>' or visit https://staticcheck.io/docs/checks for documentation on checks.
changed the title [-]unused: type declared inside function and used in struct literal[/-][+]unused: false positive involving unnamed struct types, named struct types and implicit conversions[/+]on Aug 12, 2020
Activity
dgryski commentedon Aug 12, 2020
Does this reproduce with the latest staticcheck?
kylrth commentedon Aug 12, 2020
Yes, I get the following output with
staticcheckbuilt from master on this repo:dominikh commentedon Aug 12, 2020
Simpler reproducer:
the issue seems to be caused by the implicit conversion to the unnamed struct type in
Thing.[-]unused: type declared inside function and used in struct literal[/-][+]unused: false positive involving unnamed struct types, named struct types and implicit conversions[/+]qdm12 commentedon Mar 18, 2022
I can confirm (found using
golangci-lintv1.44.2built using Go 1.18):Error:
unused: reimplement check using the AST