@@ -17,10 +17,26 @@ import (
1717
1818const help = `PROGNAME is a tool for static analysis of Go programs.
1919
20- PROGNAME examines Go source code and reports suspicious constructs,
21- such as Printf calls whose arguments do not align with the format
22- string. It uses heuristics that do not guarantee all reports are
23- genuine problems, but it can find errors not caught by the compilers.
20+ PROGNAME examines Go source code and reports diagnostics for
21+ suspicious constructs or opportunities for improvement.
22+ Diagnostics may include suggested fixes.
23+
24+ An example of a suspicious construct is a Printf call whose arguments
25+ do not align with the format string. Analyzers may use heuristics that
26+ do not guarantee all reports are genuine problems, but can find
27+ mistakes not caught by the compiler.
28+
29+ An example of an opportunity for improvement is a loop over
30+ strings.Split(doc, "\n"), which may be replaced by a loop over the
31+ strings.SplitSeq iterator, avoiding an array allocation.
32+ Diagnostics in such cases may report non-problems,
33+ but should carry fixes that may be safely applied.
34+
35+ For analyzers of the first kind, use "go vet -vettool=PROGRAM"
36+ to run the tool and report diagnostics.
37+
38+ For analyzers of the second kind, use "go fix -fixtool=PROGRAM"
39+ to run the tool and apply the fixes it suggests.
2440`
2541
2642// Help implements the help subcommand for a multichecker or unitchecker
@@ -29,7 +45,7 @@ genuine problems, but it can find errors not caught by the compilers.
2945func Help (progname string , analyzers []* analysis.Analyzer , args []string ) {
3046 // No args: show summary of all analyzers.
3147 if len (args ) == 0 {
32- fmt .Println (strings .Replace (help , "PROGNAME" , progname , - 1 ))
48+ fmt .Println (strings .ReplaceAll (help , "PROGNAME" , progname ))
3349 fmt .Println ("Registered analyzers:" )
3450 fmt .Println ()
3551 sort .Slice (analyzers , func (i , j int ) bool {
0 commit comments