Skip to content
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

x/tools/gopls: add 'unused' analyses from staticcheck #36602

stamblerre opened this issue Jan 16, 2020 · 3 comments

x/tools/gopls: add 'unused' analyses from staticcheck #36602

stamblerre opened this issue Jan 16, 2020 · 3 comments


Copy link

@stamblerre stamblerre commented Jan 16, 2020

We don't have analyses in gopls because they require whole program evaluation (due to test variants). We should investigate how we can add these analyses.

@gopherbot gopherbot added this to the Unreleased milestone Jan 16, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls unplanned Jan 16, 2020
@stamblerre stamblerre changed the title x/tools/gopls: add unused analyses from staticcheck x/tools/gopls: add 'unused' analyses from staticcheck Jan 29, 2020
@stamblerre stamblerre modified the milestones: gopls unplanned, Unreleased Jan 29, 2020
Copy link
Contributor Author

@stamblerre stamblerre commented Mar 12, 2020

Copy link

@gopherbot gopherbot commented Mar 25, 2020

Change mentions this issue: internal/lsp/analysis: add pass for unused parameters

Copy link

@ridersofrohan ridersofrohan commented Mar 25, 2020 provides an opt in analyzer to detect potentially unused parameters.

It still needs some work, specifically:

  • Add better handling for methods, if we enable methods, we will get false positives if a struct is potentially implementing an interface.
  • Add suggested fixes to automatically remove the unused parameter.
    • We could replace the unused parameter with "_". To ensure that the function prototype still matches.
    • Then later we could remove the unused parameter from the function declaration and potentially even remove the argument from every use of this function
gopherbot pushed a commit to golang/tools that referenced this issue Mar 26, 2020
This change adds a pass that checks for unused parameters inside of a function. It is disabled by default.

Updates golang/go#36602

Change-Id: I9e8de3368f16f27e7816ec4ddb16935e1a05584e
Run-TryBot: Rohan Challa <>
TryBot-Result: Gobot Gobot <>
Reviewed-by: Rebecca Stambler <>
@ridersofrohan ridersofrohan removed their assignment Apr 1, 2020
@stamblerre stamblerre removed this from the Unreleased milestone Jul 23, 2020
@stamblerre stamblerre added this to the gopls/unplanned milestone Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants