1
0
mirror of https://github.com/golang/go synced 2024-10-05 07:21:25 -06:00
go/src/cmd/vet
Konstantin Shaposhnikov b8a2e25f55 cmd/vet: remove -test flag
-test flag is a testing only flag that enables all vet checks. It was needed
because there was no way to run all vet checks in a single command
invocation. However it is possible to do this now by combining -all and -shadow
flags.

Also a recently added -tests flag is similarly named, having both -test and
-tests can be confusing.

Change-Id: Ie5bacbe0bef5c8409eeace46f16141fa4e782c32
Reviewed-on: https://go-review.googlesource.com/20006
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-07 22:54:38 +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: Use function signature to find format string index. 2016-03-04 00:00: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: diagnose plain assignment in copylock detector 2015-09-10 16:55:51 +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: remove -test flag 2016-03-07 22:54:38 +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: Use function signature to find format string index. 2016-03-04 00:00:20 +00:00
rangeloop.go all: link to https instead of http 2015-07-11 14:36:33 +00:00
README cmd/vet: add a README explaining the criteria for new checks 2016-03-01 20:48:20 +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

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.