From 0c0aed3c9f2c37523eaa7ba17432fdbe3d05ea52 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 7 Nov 2017 07:53:55 -0800 Subject: [PATCH] cmd/vet: change docs to prefer "go vet" over "go tool vet" Updates #22530 Change-Id: I161b5e706483744321e6089f747bd761310774eb Reviewed-on: https://go-review.googlesource.com/76390 Reviewed-by: Rob Pike --- src/cmd/vet/doc.go | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/cmd/vet/doc.go b/src/cmd/vet/doc.go index 1ee44a43fc..3df975cacc 100644 --- a/src/cmd/vet/doc.go +++ b/src/cmd/vet/doc.go @@ -9,19 +9,15 @@ calls whose arguments do not align with the format string. Vet uses heuristics that do not guarantee all reports are genuine problems, but it can find errors not caught by the compilers. -It can be invoked three ways: +Vet is normally invoked using the go command by running "go vet": + + go vet +vets the package in the current directory. -By package, from the go tool: go vet package/path/name vets the package whose path is provided. -By files: - go tool vet source/directory/*.go -vets the files named, all of which must be in the same package. - -By directory: - go tool vet source/directory -recursively descends the directory, vetting each package it finds. +Use "go help packages" to see other ways of specifying which packages to vet. Vet's exit code is 2 for erroneous invocation of the tool, 1 if a problem was reported, and 0 otherwise. Note that the tool does not @@ -211,5 +207,18 @@ These flags configure the behavior of vet: For more information, see the discussion of the -printf flag. -shadowstrict Whether to be strict about shadowing; can be noisy. + +Using vet directly + +For testing and debugging vet can be run directly by invoking +"go tool vet" or just running the binary. Run this way, vet might not +have up to date information for imported packages. + + go tool vet source/directory/*.go +vets the files named, all of which must be in the same package. + + go tool vet source/directory +recursively descends the directory, vetting each package it finds. + */ package main -- 2.48.1