...
Run Format

Text file src/cmd/vet/README

Documentation: cmd/vet

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

View as plain text