Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var UnusedParam = &analysis.Analyzer{
Name: "unusedparam",
Doc: "report unused parameters that should be unnamed, or blank when the list keeps its names",
Run: runUnusedParam,
}
UnusedParam reports parameters a function never references, and says how to spell them by whether any parameter is used at all.
Go requires a parameter list to be either wholly named or wholly unnamed, so the two cases differ. When every parameter goes unused the whole list can drop its names and stand as types alone, which is both shorter and more honest than a row of blank identifiers. When some parameters are used the list must stay named, and the blank identifier is then the only way to mark the rest as ignored.
var UnusedRecv = &analysis.Analyzer{
Name: "unusedrecv",
Doc: "report method receivers that go unused and should therefore be unnamed",
Run: runUnusedRecv,
}
UnusedRecv reports a method that names a receiver it never references.
Go lets a receiver be declared by type alone, and that spelling states the fact directly: the method does not read what it is called on. Any name invites the reader to look for a use that is not there, and the blank identifier is no better — it spends a slot saying "ignored" where saying nothing is available.
Functions ¶
Types ¶
This section is empty.