mirror of https://github.com/golang/go.git
This analyzer suggests fixes for unused variable errors. In declarations it will remove the whole statement if the offending variable is the only one declared in that statement, otherwise it will just delete the offending variable. In assignments it will remove the whole statement if the offending variable is the only one assigned in that statement, otherwise it will rename the offending variable to `_`. If the assignment RHS contains a statement that can cause a side effect (a function call or reading from a channel), the assignment will be removed but RHS will be preserved. Fixes golang/go#48975 Change-Id: I3850f1b0340cd5ae63249931df3a5403d8617080 Reviewed-on: https://go-review.googlesource.com/c/tools/+/394934 Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com> |
||
|---|---|---|
| .. | ||
| testdata/src | ||
| unusedvariable.go | ||
| unusedvariable_test.go | ||