tools/go/analysis/passes/vet
Alan Donovan 06b1b3f6e3 go/analysis/passes/bools: split out of vet
And rename from "bool" to "bools".

Using analysistest unearthed a minor bug,
github.com/golang/go/issues/28086.
To avoid complicating the diff we work
around it in the tests for now.

Change-Id: I682f33506de778dfdfe97841cd2b16e3d47062b8
Reviewed-on: https://go-review.googlesource.com/c/140737
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-10 17:25:13 +00:00
..
internal/whitelist go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
testdata go/analysis/passes/bools: split out of vet 2018-10-10 17:25:13 +00:00
README go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
REVISION go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
cgo.go go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
composite.go go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
dead.go go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
doc.go go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
httpresponse.go go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
main.go go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
nilfunc.go go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
print.go go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
shadow.go go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
shift.go go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
structtag.go go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
tests.go go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
types.go go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
unsafeptr.go go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00
vet_test.go go/analysis/passes/vet: fork cmd/vet@31d19c0 2018-09-27 19:02:35 +00:00

README

Vet is a tool that checks correctness of Go programs. It runs a suite of tests,
each tailored to check for a particular class of errors. Examples include incorrect
Printf format verbs and malformed build tags.

Over time many checks have been added to vet's suite, but many more have been
rejected as not appropriate for the tool. The criteria applied when selecting which
checks to add are:

Correctness:

Vet's checks are about correctness, not style. A vet check must identify real or
potential bugs that could cause incorrect compilation or execution. A check that
only identifies stylistic points or alternative correct approaches to a situation
is not acceptable.

Frequency:

Vet is run every day by many programmers, often as part of every compilation or
submission. The cost in execution time is considerable, especially in aggregate,
so checks must be likely enough to find real problems that they are worth the
overhead of the added check. A new check that finds only a handful of problems
across all existing programs, even if the problem is significant, is not worth
adding to the suite everyone runs daily.

Precision:

Most of vet's checks are heuristic and can generate both false positives (flagging
correct programs) and false negatives (not flagging incorrect ones). The rate of
both these failures must be very small. A check that is too noisy will be ignored
by the programmer overwhelmed by the output; a check that misses too many of the
cases it's looking for will give a false sense of security. Neither is acceptable.
A vet check must be accurate enough that everything it reports is worth examining,
and complete enough to encourage real confidence.