go/src/cmd/vet
Aliaksandr Valialkin 72a1b53b67 cmd/vet: allow lock types inside built-in new()
Updates #14839
Fixes #14994

Change-Id: I9bb51bad19105a17c80d690c5486e5dd007ac84a
Reviewed-on: https://go-review.googlesource.com/21222
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-30 00:16:48 +00:00
..
internal/whitelist cmd/vet: move cmd/vet/whitelist to cmd/vet/internal/whitelist 2015-12-05 06:26:17 +00:00
testdata cmd/vet: allow lock types inside built-in new() 2016-03-30 00:16:48 +00:00
README cmd/vet: add a README explaining the criteria for new checks 2016-03-01 20:48:20 +00:00
asmdecl.go all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
assign.go
atomic.go
bool.go
buildtag.go all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
cgo.go all: single space after period. 2016-03-02 00:13:47 +00:00
composite.go cmd/vet: move cmd/vet/whitelist to cmd/vet/internal/whitelist 2015-12-05 06:26:17 +00:00
copylock.go cmd/vet: allow lock types inside built-in new() 2016-03-30 00:16:48 +00:00
deadcode.go all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
doc.go cmd/vet: remove -test flag 2016-03-07 22:54:38 +00:00
main.go cmd/vet: check lock copy in function calls and return statements 2016-03-23 07:14:26 +00:00
method.go all: single space after period. 2016-03-02 00:13:47 +00:00
nilfunc.go cmd/vet: adjust vet to use go/types and friends from std repo 2015-06-04 21:24:52 +00:00
print.go cmd/vet: improve detecting printf-like format argument 2016-03-29 23:40:52 +00:00
rangeloop.go cmd/vet: don't treat fields like variables in rangeloop check 2016-03-27 05:31:54 +00:00
shadow.go cmd/vet: polish output of shadow test 2016-03-02 00:49:39 +00:00
shift.go cmd/vet: adjust vet to use go/types and friends from std repo 2015-06-04 21:24:52 +00:00
structtag.go
tests.go cmd/vet: add a check for tests with malformed names 2016-02-24 10:40:34 +00:00
types.go cmd/vet: remove dependency on types.New 2015-06-08 20:52:07 +00:00
unsafeptr.go all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
unused.go go/types: port recent x/tools/go/types fixes 2015-06-15 20:11:37 +00:00
vet_test.go cmd/vet: remove -test flag 2016-03-07 22:54:38 +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 or 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 tools 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.