Debian Codegraph @

gopls/internal/analysis/unusedparams/doc.go

raw symbols SCIP
1 // Copyright 2023 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Package unusedparams defines an analyzer that checks for unused
6 // parameters of functions.
7 //
8 // # Analyzer unusedparams
9 //
10 // unusedparams: check for unused parameters of functions
11 //
12 // The unusedparams analyzer checks functions to see if there are
13 // any parameters that are not being used.
14 //
15 // To ensure soundness, it ignores:
16 // - "address-taken" functions, that is, functions that are used as
17 // a value rather than being called directly; their signatures may
18 // be required to conform to a func type.
19 // - exported functions or methods, since they may be address-taken
20 // in another package.
21 // - unexported methods whose name matches an interface method
22 // declared in the same package, since the method's signature
23 // may be required to conform to the interface type.
24 // - functions with empty bodies, or containing just a call to panic.
25 // - parameters that are unnamed, or named "_", the blank identifier.
26 //
27 // The analyzer suggests a fix of replacing the parameter name by "_",
28 // but in such cases a deeper fix can be obtained by invoking the
29 // "Refactor: remove unused parameter" code action, which will
30 // eliminate the parameter entirely, along with all corresponding
31 // arguments at call sites, while taking care to preserve any side
32 // effects in the argument expressions; see
33 // https://github.com/golang/tools/releases/tag/gopls%2Fv0.14.
34 //
35 // This analyzer ignores generated code.
36 package unusedparams