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
Staticcheck version: 2022.1.2 (v0.3.2)
Go version: 1.18.3
Reacted by Peter Zeller, Hardy Jones, Antonin Stefanutti, João Pires, Daniel Martí, Oskar Haarklou Veileborg, Nic Klaassen, Aaron Beitch and Mykhailo Bobrovskyi
Any update? I'm using 0.3.3 version in go 1.19.4, and this issue is still exist, but my colleagues don't have this problem and they work well, did I miss something?
No, we didn't fix this yet. I don't know why your colleagues wouldn't have the problem.
Thank‘s for your answer, I'm not sure why my colleagues wouldn't have the problem, we're working remotely, maybe they got it wrong somewhere, anyway, I've ignored "unused" in GitHub workflow for now, and looking forward to your fix, thank's again.
Raising my hand as well: it's only recently that I've started encountering generics in codebases at work, so I'm starting to see a few unused false positives as well. I think they are all caused by this bug, because the methods being marked as unused then mark other top-level funcs and types as unused as well.
I also tripped over this bug. It was a bit annoying that a simple nolint above the affected methods didn't suffice: Subsequently to the seemingly unused method, a lot of other dependencies (like referenced constants and struct members) were also marked as unused.
My workaround was to export the method while keeping the interface unexported. For my use case, this was a feasible tradeoff.
Reacted by Joaquim Maria Fornaguera Marimon and Mykhailo Bobrovskyi
I cannot reproduce the problem anymore, so it has probably been fixed. If anyone disagrees, leave a comment with steps to reproduce and I'll reopen the issue.
Activity
dominikh commentedon Jun 27, 2022
Thanks, I'll add it to the test cases.
Rory-Z commentedon Dec 12, 2022
Any update? I'm using 0.3.3 version in go 1.19.4, and this issue is still exist, but my colleagues don't have this problem and they work well, did I miss something?
dominikh commentedon Dec 12, 2022
No, we didn't fix this yet. I don't know why your colleagues wouldn't have the problem.
Rory-Z commentedon Dec 12, 2022
Thank‘s for your answer, I'm not sure why my colleagues wouldn't have the problem, we're working remotely, maybe they got it wrong somewhere, anyway, I've ignored "unused" in GitHub workflow for now, and looking forward to your fix, thank's again.
mvdan commentedon Dec 13, 2022
Raising my hand as well: it's only recently that I've started encountering generics in codebases at work, so I'm starting to see a few unused false positives as well. I think they are all caused by this bug, because the methods being marked as unused then mark other top-level funcs and types as unused as well.
Rory-Z commentedon Dec 14, 2022
dominikh commentedon Jan 1, 2023
Rory-Z commentedon Jan 3, 2023
qfornaguera commentedon Nov 2, 2023
Hello there!
I'm dropping here a case I've wrongly posted in golangci-lint repository. Maybe it helps
Removing
WithSomethingfrom the interface or changing the unexported (build->Build) make the lint disappearphonovision commentedon Apr 19, 2024
I also tripped over this bug. It was a bit annoying that a simple
nolintabove the affected methods didn't suffice: Subsequently to the seemingly unused method, a lot of other dependencies (like referenced constants and struct members) were also marked as unused.My workaround was to export the method while keeping the interface unexported. For my use case, this was a feasible tradeoff.
Export interface methods for queueMetrics[T]
Ignore false positives from unused linter
Ignore false positives from unused linter
dominikh commentedon May 31, 2026
I cannot reproduce the problem anymore, so it has probably been fixed. If anyone disagrees, leave a comment with steps to reproduce and I'll reopen the issue.
unused: use proper type unification for 'implements'
unused: use proper type unification for 'implements'
unused: use proper type unification for 'implements'
unused: use proper type unification for 'implements'
unused: use proper type unification for 'implements'
Ignore false positives from unused linter
Linting: drop obsolete "unused" exclusion