From c262de870b618eed648983aa994b03bc04641c72 Mon Sep 17 00:00:00 2001 From: "Matt T. Proud" Date: Tue, 15 Sep 2015 19:11:23 +0200 Subject: [PATCH] tools/cmd/vet: Sort checks list alphabetically. The existing list of checks in doc.go has become somewhat unwieldy. This commit is purely cosmetic and sorts the list alphabetically keyed by the flag name. Change-Id: Ibb56357f9d4667d199acc6637dc28f6e17903046 Reviewed-on: https://go-review.googlesource.com/14558 Reviewed-by: Rob Pike --- cmd/vet/doc.go | 124 ++++++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/cmd/vet/doc.go b/cmd/vet/doc.go index decc0351..012f88b3 100644 --- a/cmd/vet/doc.go +++ b/cmd/vet/doc.go @@ -37,49 +37,6 @@ except the printf check. Available checks: -Printf family - -Flag: -printf - -Suspicious calls to functions in the Printf family, including any functions -with these names, disregarding case: - Print Printf Println - Fprint Fprintf Fprintln - Sprint Sprintf Sprintln - Error Errorf - Fatal Fatalf - Log Logf - 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. - -Methods - -Flag: -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 - -Struct tags - -Flag: -structtags - -Struct tags that do not follow the format understood by reflect.StructTag.Get. -Well-known encoding struct tags (json, xml) used with unexported fields. - -Unkeyed composite literals - -Flag: -composites - -Composite struct literals that do not use the field-keyed syntax. - Assembly declarations Flag: -asmdecl @@ -110,36 +67,92 @@ Flag: -buildtags Badly formed or misplaced +build tags. +Unkeyed composite literals + +Flag: -composites + +Composite struct literals that do not use the field-keyed syntax. + Copying locks Flag: -copylocks Locks that are erroneously passed by value. +Documentation examples + +Flag: -example + +Mistakes involving example tests, including examples with incorrect names or +function signatures, or that document identifiers not in the package. + +Methods + +Flag: -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 + Nil function comparison Flag: -nilfunc Comparisons between functions and nil. +Printf family + +Flag: -printf + +Suspicious calls to functions in the Printf family, including any functions +with these names, disregarding case: + Print Printf Println + Fprint Fprintf Fprintln + Sprint Sprintf Sprintln + Error Errorf + Fatal Fatalf + Log Logf + 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. + Range loop variables Flag: -rangeloops Incorrect uses of range loop variables in closures. -Unreachable code - -Flag: -unreachable - -Unreachable code. - Shadowed variables Flag: -shadow=false (experimental; must be set explicitly) Variables that may have been unintentionally shadowed. +Shifts + +Flag: -shift + +Shifts equal to or longer than the variable's length. + +Struct tags + +Flag: -structtags + +Struct tags that do not follow the format understood by reflect.StructTag.Get. +Well-known encoding struct tags (json, xml) used with unexported fields. + +Unreachable code + +Flag: -unreachable + +Unreachable code. + Misuse of unsafe Pointers Flag: -unsafeptr @@ -159,19 +172,6 @@ discarded. By default, this includes functions like fmt.Errorf and fmt.Sprintf and methods like String and Error. The flags -unusedfuncs and -unusedstringmethods control the set. -Shifts - -Flag: -shift - -Shifts equal to or longer than the variable's length. - -Documentation examples - -Flag: -example - -Mistakes involving example tests, including examples with incorrect names or -function signatures, or that document identifiers not in the package. - Other flags These flags configure the behavior of vet: