From: Shenghou Ma Date: Wed, 29 Feb 2012 18:22:35 +0000 (+0800) Subject: doc: elaborate available checks for cmd/vet X-Git-Tag: weekly.2012-03-04~87 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=df3a841021ed2a983f87fec477017e85268f2ac2;p=gostls13.git doc: elaborate available checks for cmd/vet R=golang-dev, r, ality, r CC=golang-dev https://golang.org/cl/5709053 --- diff --git a/src/cmd/vet/doc.go b/src/cmd/vet/doc.go index 2495e8027b..e51fe37685 100644 --- a/src/cmd/vet/doc.go +++ b/src/cmd/vet/doc.go @@ -4,18 +4,42 @@ /* -Vet does simple checking of Go source code. +Vet examines Go source code and reports suspicious constructs, such as Printf +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 checks for simple errors in calls to functions named +Available checks: + +1. Printf family + +Suspicious calls to functions in the Printf familiy, including any functions +with these names: Print Printf Println Fprint Fprintf Fprintln Sprint Sprintf Sprintln Error Errorf Fatal Fatalf + Panic Panicf Panicln If the function name ends with an 'f', the function is assumed to take a format descriptor string in the manner of fmt.Printf. If not, vet complains about arguments that look like format descriptor strings. +It also checks for errors such as using a Writer as the first argument of +Printf. + +2. Methods + +Non-standard signatures for methods with familiar names, including: + Format GobEncode GobDecode MarshalJSON MarshalXML + Peek ReadByte ReadFrom ReadRune Scan Seek + UnmarshalJSON UnreadByte UnreadRune WriteByte + WriteTo + +3. Struct tags + +Struct tags that do not follow the format understood by reflect.StructTag.Get. + Usage: go tool vet [flag] [file.go ...]