package sharedcheck
import "honnef.co/go/tools/internal/sharedcheck"
Index ¶
- func CheckRangeStringRunes(pass *analysis.Pass) (interface{}, error)
- func RedundantTypeInDeclarationChecker(verb string, flagHelpfulTypes bool) *analysis.Analyzer
Functions ¶
func CheckRangeStringRunes ¶
func RedundantTypeInDeclarationChecker ¶
RedundantTypeInDeclarationChecker returns a checker that flags variable declarations with redundantly specified types. That is, it flags 'var v T = e' where e's type is identical to T and 'var v = e' (or 'v := e') would have the same effect.
It does not flag variables under the following conditions, to reduce the number of false positives: - global variables – these often specify types to aid godoc - files that use cgo – cgo code generation and pointer checking emits redundant types
It does not flag variables under the following conditions, unless flagHelpfulTypes is true, to reduce the number of noisy positives: - packages that import syscall or unsafe – these sometimes use this form of assignment to make sure types are as expected - variables named the blank identifier – a pattern used to confirm the types of variables - untyped expressions on the rhs – the explicitness might aid readability
Source Files ¶
lint.go
- Version
- v0.3.1
- Published
- Apr 24, 2022
- Platform
- darwin/amd64
- Imports
- 15 packages
- Last checked
- 16 minutes ago –
Tools for package owners.