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 the nilness analysis #44627

Closed
ainar-g opened this issue Feb 26, 2021 · 3 comments
Closed

x/tools/gopls: add the nilness analysis #44627

ainar-g opened this issue Feb 26, 2021 · 3 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@ainar-g
Copy link
Contributor

ainar-g commented Feb 26, 2021

The nilness analysis pass can detect some absurd conditions, like checking a value that has already been proven non-nil against nil. This is especially useful during refactoring, when a new nil check appears before an existing one. I think that this analysis would be a good fit for the gopls analysis suite. If I recall correctly, it uses SSA, so it should probably be disabled by default.

If there are no objections, I am ready to send a CL soon-ish.

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Feb 26, 2021
@gopherbot gopherbot added this to the Unreleased milestone Feb 26, 2021
@findleyr
Copy link
Contributor

Note that nilness was removed in https://golang.org/cl/219203, specifically because of the resources that SSA consumes.

That said, it makes sense to have available yet disabled by default.

@stamblerre stamblerre modified the milestones: Unreleased, gopls/v1.0.0 Feb 26, 2021
@stamblerre stamblerre added this to To Do in gopls on-deck Feb 28, 2021
@gopherbot
Copy link

Change https://golang.org/cl/299131 mentions this issue: internal/lsp/source: add the nilness analyzer

@ainar-g
Copy link
Contributor Author

ainar-g commented Mar 8, 2021

Thanks for the review!

@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.6.7 Mar 9, 2021
@stamblerre stamblerre moved this from To Do to Done in gopls on-deck Aug 12, 2021
@golang golang locked and limited conversation to collaborators Mar 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
No open projects
Development

No branches or pull requests

4 participants