Skip to content

Commit 1be7b45

Browse files
committed
go/analysis/passes/vet: fork cmd/vet@31d19c0
This change creates a fork of vet from the standard distribution. It was created by this script: $ mkdir go/analysis/passes/vet/ $ cd go/analysis/passes/vet/ $ (cd $GOROOT/src/cmd/vet >/dev/null && git co 31d19c0 && tar cf - .) | tar xf - $ rm -fr all # We'll deal with cmd/vet/all later. $ rm -fr internal/cfg # Published as golang.org/x/tools/go/cfg. $ sed -i -e '1s?^?// +build ignore\n\n?' *.go All the Go files have been tagged "ignore" for now. A series of follow-up changes will convert each vet check into an instance of the new go/analysis API's Analyzer. At some point soon, cmd/vet in the standard distribution will use a vendored copy of this code. Until then we will periodically integrate any changes made to cmd/vet to this fork. The current version of cmd/vet will be recorded in the REVISION file. Change-Id: I0c63eeb17cc612b3f013679595dcbc71a90950f7 Reviewed-on: https://go-review.googlesource.com/138137 Reviewed-by: Michael Matloob <[email protected]>
1 parent b41e4b4 commit 1be7b45

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+13029
-0
lines changed

go/analysis/passes/vet/README

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Vet is a tool that checks correctness of Go programs. It runs a suite of tests,
2+
each tailored to check for a particular class of errors. Examples include incorrect
3+
Printf format verbs and malformed build tags.
4+
5+
Over time many checks have been added to vet's suite, but many more have been
6+
rejected as not appropriate for the tool. The criteria applied when selecting which
7+
checks to add are:
8+
9+
Correctness:
10+
11+
Vet's checks are about correctness, not style. A vet check must identify real or
12+
potential bugs that could cause incorrect compilation or execution. A check that
13+
only identifies stylistic points or alternative correct approaches to a situation
14+
is not acceptable.
15+
16+
Frequency:
17+
18+
Vet is run every day by many programmers, often as part of every compilation or
19+
submission. The cost in execution time is considerable, especially in aggregate,
20+
so checks must be likely enough to find real problems that they are worth the
21+
overhead of the added check. A new check that finds only a handful of problems
22+
across all existing programs, even if the problem is significant, is not worth
23+
adding to the suite everyone runs daily.
24+
25+
Precision:
26+
27+
Most of vet's checks are heuristic and can generate both false positives (flagging
28+
correct programs) and false negatives (not flagging incorrect ones). The rate of
29+
both these failures must be very small. A check that is too noisy will be ignored
30+
by the programmer overwhelmed by the output; a check that misses too many of the
31+
cases it's looking for will give a false sense of security. Neither is acceptable.
32+
A vet check must be accurate enough that everything it reports is worth examining,
33+
and complete enough to encourage real confidence.

go/analysis/passes/vet/REVISION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cmd/vet@31d19c0

0 commit comments

Comments
 (0)