1
0
mirror of https://github.com/golang/go synced 2024-11-13 19:50:21 -07:00
go/src/cmd/vet
Josh Bleecher Snyder 016569f204 cmd/vet/all: move suspicious shift whitelists to 64 bit
This is an inconsequential consequence of updating
math/big to use math/bits.

Better would be to teach the vet shift test
to size int/uint/uintptr to the platform in use,
eliminating the whole category of "might be too small".
Filed #19321 for that.

Change-Id: I7e0b837bd329132d7a564468c18502dd2e724fc6
Reviewed-on: https://go-review.googlesource.com/37576
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-28 19:12:00 +00:00
..
all cmd/vet/all: move suspicious shift whitelists to 64 bit 2017-02-28 19:12:00 +00:00
internal cmd/vet/internal/cfg: don't crash on malformed goto statement 2016-06-22 17:09:26 +00:00
testdata cmd/vet: include function name or value in copylock message 2017-01-03 19:23:23 +00:00
asmdecl.go cmd/vet: add support for GOARCH=mips{,le} 2016-11-04 18:26:49 +00:00
assign.go
atomic.go cmd/vet: do not treat declaration as asignment in atomic check 2016-04-06 16:38:24 +00:00
bool.go
buildtag.go all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
cgo.go cmd/vet: avoid crash in cgo test on recursive type 2016-12-21 04:29:31 +00:00
composite.go cmd/vet: improve checking unkeyed fields in composite literals 2016-04-28 13:51:40 +00:00
copylock.go cmd/vet: include function name or value in copylock message 2017-01-03 19:23:23 +00:00
deadcode.go cmd/vet: -lostcancel: check for discarded result of context.WithCancel 2016-06-21 14:58:33 +00:00
doc.go cmd/vet: detect defer resp.Body.Close() before error check 2016-11-10 20:38:11 +00:00
httpresponse.go cmd/vet: detect defer resp.Body.Close() before error check 2016-11-10 20:38:11 +00:00
lostcancel.go cmd/vet: lostcancel: treat naked return as a use of named results 2016-06-30 21:53:32 +00:00
main.go cmd/vet: accept space-separated tag lists for compatibility with cmd/go 2016-10-25 20:42:01 +00:00
method.go all: single space after period. 2016-03-02 00:13:47 +00:00
nilfunc.go
print.go cmd/vet: ignore unrecognized verbs for fmt.Formatter 2016-11-13 15:03:26 +00:00
rangeloop.go cmd/vet: don't treat fields like variables in rangeloop check 2016-03-27 05:31:54 +00:00
README cmd/vet: add a README explaining the criteria for new checks 2016-03-01 20:48:20 +00:00
shadow.go Revert "cmd/vet: teach vet about ast.AliasSpec" 2016-11-05 00:18:05 +00:00
shift.go cmd/vet: allow large shifts of constants 2016-08-18 23:39:37 +00:00
structtag.go cmd/vet: fix panic and handling of XML in struct field tag check 2016-12-13 03:13:24 +00:00
tests.go cmd/vet: make checking example names in _test packages more robust 2016-06-28 22:09:00 +00:00
types.go cmd/vet: ignore unrecognized verbs for fmt.Formatter 2016-11-13 15:03:26 +00:00
unsafeptr.go cmd/vet: allow ^& uintptr arithmetic 2016-08-17 20:48:57 +00:00
unused.go
vet_test.go cmd/vet: avoid crash in cgo test on recursive type 2016-12-21 04:29:31 +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.