@@ -72,11 +72,13 @@ To add a new Analyzer to an existing driver, add another item to the list:
72
72
73
73
A driver may use the name, flags, and documentation to provide on-line
74
74
help that describes the analyses its performs.
75
+ The doc comment contains a brief one-line summary,
76
+ optionally followed by paragraphs of explanation.
75
77
The vet command, shown below, is an example of a driver that runs
76
78
multiple analyzers. It is based on the multichecker package
77
79
(see the "Standalone commands" section for details).
78
80
79
- $ go build golang.org/x/tools/cmd/vet
81
+ $ go build golang.org/x/tools/go/analysis/ cmd/vet
80
82
$ ./vet help
81
83
vet is a tool for static analysis of Go programs.
82
84
@@ -285,6 +287,16 @@ pointed to by fact. This scheme assumes that the concrete type of fact
285
287
is a pointer; this assumption is checked by the Validate function.
286
288
See the "printf" analyzer for an example of object facts in action.
287
289
290
+ Some driver implementations (such as those based on Bazel and Blaze) do
291
+ not currently apply analyzers to packages of the standard library.
292
+ Therefore, for best results, analyzer authors should not rely on
293
+ analysis facts being available for standard packages.
294
+ For example, although the printf checker is capable of deducing during
295
+ analysis of the log package that log.Printf is a printf-wrapper,
296
+ this fact is built in to the analyzer so that it correctly checks
297
+ calls to log.Printf even when run in a driver that does not apply
298
+ it to standard packages. We plan to remove this limitation in future.
299
+
288
300
289
301
Testing an Analyzer
290
302
@@ -298,14 +310,14 @@ diagnostics and facts (and no more). Expectations are expressed using
298
310
Standalone commands
299
311
300
312
Analyzers are provided in the form of packages that a driver program is
301
- expected to import. The vet command imports a set of several analyses ,
313
+ expected to import. The vet command imports a set of several analyzers ,
302
314
but users may wish to define their own analysis commands that perform
303
315
additional checks. To simplify the task of creating an analysis command,
304
316
either for a single analyzer or for a whole suite, we provide the
305
317
singlechecker and multichecker subpackages.
306
318
307
319
The singlechecker package provides the main function for a command that
308
- runs one analysis . By convention, each analyzer such as
320
+ runs one analyzer . By convention, each analyzer such as
309
321
go/passes/findcall should be accompanied by a singlechecker-based
310
322
command such as go/analysis/passes/findcall/cmd/findcall, defined in its
311
323
entirety as:
0 commit comments