Rule | Description | KPI | URL |
---|---|---|---|
golint-errorShouldBeLastReturn | error should be the last type when returning multiple items | Robustness | https://github.com/golang/lint/blob/master/lint.go |
golint-annoyingUseExportedType | exported function returns unexported type, which can be annoying to use. | Robustness | https://github.com/golang/lint/blob/master/lint.go |
golint-ifBlockReturn | if block ends with a return statement, so drop this else and outdent its block | Accuracy | https://github.com/golang/lint/blob/master/lint.go |
golint-receiverNameShouldBeConsistent | receiver name should be consistent with previous receiver name | Robustness | https://github.com/golang/lint/blob/master/lint.go |
golint-receiverNameShouldBeReflection | receiver name should be a reflection of its identity; don’t use generic names such as “this” or “self” | Robustness | https://github.com/golang/lint/blob/master/lint.go |
golint-receiverNameShouldNotBeUnderscore | receiver name should not be an underscore, omit the name if it is unused | Understandability | https://github.com/golang/lint/blob/master/lint.go |
golint-dropAssignment | should drop = from declaration of var. it is the zero value | Understandability | https://github.com/golang/lint/blob/master/lint.go |
golint-blankImport | a blank import should be only in a main or test package, or have a comment justifying it | Efficiency | https://github.com/golang/lint/blob/master/lint.go |
golint-contextContextFirstArg | context.Context should be the first parameter of a function | Understandability | https://github.com/golang/lint/blob/master/lint.go |
golint-avoidUnitSpecificSuffix | don’t use unit-specific suffix Sec | Robustness | https://github.com/golang/lint/blob/master/lint.go |
golint-packageCommentDetached | package comment is detached; there should be no blank lines between it and the package statement | Understandability | https://github.com/golang/lint/blob/master/lint.go |
golint-packageNameStutters | Package name stutters. Consider using other names | Understandability | https://github.com/golang/lint/blob/master/lint.go |
golint-avoidBasicTypeAsKey | should not use basic type as key in context.WithValue | Robustness | https://github.com/golang/lint/blob/master/lint.go |
vet-printfFormatting | Suspicious calls to functions in the Printf family, including any functions with these names, disregarding case:
Print Printf Println The -printfuncs flag can be used to redefine this list. 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. |
Understandability | https://golang.org/cmd/vet/#hdr-Printf_family |
vet-unreachableCode | Unreachable code | Robustness | https://golang.org/cmd/vet/#hdr-Unreachable_code |
vet-shadow | Variables that may have been unintentionally shadowed. | Maintainability | https://golang.org/cmd/vet/#hdr-Shadowed_variables |
vet-copyingLock | Locks that are erroneously passed by value. | Robustness | https://golang.org/cmd/vet/#hdr-Copying_locks |
vet-boolCondError | Mistakes involving boolean operators. | Accuracy | https://golang.org/cmd/vet/#hdr-Boolean_conditions |
vet-httpresponseUsedIncorrectly | Mistakes deferring a function call on an HTTP response before checking whether the error returned with the response was nil | Accuracy | https://golang.org/cmd/vet/#hdr-HTTP_responses_used_incorrectly |
vet-lostcancel | The cancelation function returned by context.WithCancel, WithTimeout, and WithDeadline must be called or the new context will remain live until its parent context is cancelled. (The background context is never cancelled.) | Robustness | https://golang.org/cmd/vet/#hdr-Failure_to_call_the_cancelation_function_returned_by_WithCancel |
vet-rangeloops | Incorrect uses of range loop variables in closures. | Accuracy | https://golang.org/cmd/vet/#hdr-Range_loop_variables |
vet-shiftIncorrect | Shifts equal to or longer than the variable’s length. | Accuracy | https://golang.org/cmd/vet/#hdr-Shifts |
vet-unusedresult | Calls to well-known functions and methods that return a value that is 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 | Robustness | https://golang.org/cmd/vet/#hdr-Unused_result_of_certain_function_calls |
gocyclo-cyclomaticComplexity | High cyclomatic complexity | Efficiency | https://github.com/alecthomas/gocyclo |
errcheck-returnValueNotChecked | Running errcheck on a package will report all function calls that have unchecked errors. | Accuracy | https://github.com/kisielk/errcheck |
gotype-indexOutOfBounds | Index out of bounds | Robustness | https://godoc.org/golang.org/x/tools/cmd/gotype |
gotype-incorrectConversion | Incorrect conversion of variable | Accuracy | https://godoc.org/golang.org/x/tools/cmd/gotype |
gotype-unusedVar | Variables declared but not used | Maintainability | https://godoc.org/golang.org/x/tools/cmd/gotype |