1
0
mirror of https://github.com/golang/go synced 2024-11-08 10:46:23 -07:00
go/src/cmd/vet
Daniel Martí d0ed8d6ea1 cmd/vet: %T is a formatting directive too
Some warnings were being missed, because vet's regex that finds
formatting directives was missing the 'T' verb.

Fixes #24646.

Change-Id: I2f6f9ed19e7daf9a07175199f428a62e94799ea9
Reviewed-on: https://go-review.googlesource.com/111357
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
2018-05-04 23:25:17 +00:00
..
all runtime,cmd/ld: on darwin, create theads using libc 2018-04-30 02:41:03 +00:00
internal
testdata cmd/vet: %T is a formatting directive too 2018-05-04 23:25:17 +00:00
asmdecl.go
assign.go
atomic.go
bool.go
buildtag.go
cgo.go
composite.go cmd/vet: use type information in isLocalType 2018-04-25 14:45:50 +00:00
copylock.go
dead.go cmd/vet: fix panic in dead code checker on ill-formed switch statements. 2018-04-15 23:51:20 +00:00
deadcode.go
doc.go
httpresponse.go
lostcancel.go
main.go
method.go cmd: some semi-automated cleanups 2018-04-06 13:59:29 +00:00
nilfunc.go
print.go cmd/vet: %T is a formatting directive too 2018-05-04 23:25:17 +00:00
rangeloop.go
README
shadow.go
shift.go
structtag.go
tests.go
types.go cmd/vet: better align print warnings with fmt 2018-05-04 02:57:37 +00:00
unsafeptr.go
unused.go
vet_test.go

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.