x/tools/gopls: Warn UnusedVar for unused assign #56598
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
gopls version
go env
What did you do?
Changing the value of a variable won't warn me that the new value is not being used.
Workaround 1: declaring
err
inside an if scope:This solution can get very messy. Example:
Workaround 2: different error variables:
It is cleaner, and may be the best workaround, but makes me creates more variables.
And it is not just for error handling. Warning variables that are reassigned and not used can help catching many bugs in existing code.
What did you expect to see?
Could be a warn or an error:
Example in Rust:
What did you see instead?
Nothing.
Editor and settings
I don't believe its necessary for this issue.
Logs
I don't believe its necessary for this issue.
The text was updated successfully, but these errors were encountered: