package staticcheck
import "honnef.co/go/tools/staticcheck"
Package staticcheck contains a linter for Go source code.
Index ¶
- Constants
- Variables
- func CanBinaryMarshal(pass *analysis.Pass, v Value) bool
- func CheckArgOverwritten(pass *analysis.Pass) (interface{}, error)
- func CheckBenchmarkN(pass *analysis.Pass) (interface{}, error)
- func CheckCanonicalHeaderKey(pass *analysis.Pass) (interface{}, error)
- func CheckConcurrentTesting(pass *analysis.Pass) (interface{}, error)
- func CheckCyclicFinalizer(pass *analysis.Pass) (interface{}, error)
- func CheckDeferInInfiniteLoop(pass *analysis.Pass) (interface{}, error)
- func CheckDeferLock(pass *analysis.Pass) (interface{}, error)
- func CheckDeprecated(pass *analysis.Pass) (interface{}, error)
- func CheckDiffSizeComparison(pass *analysis.Pass) (interface{}, error)
- func CheckDoubleNegation(pass *analysis.Pass) (interface{}, error)
- func CheckDubiousDeferInChannelRangeLoop(pass *analysis.Pass) (interface{}, error)
- func CheckDuplicateBuildConstraints(pass *analysis.Pass) (interface{}, error)
- func CheckEarlyDefer(pass *analysis.Pass) (interface{}, error)
- func CheckEmptyBranch(pass *analysis.Pass) (interface{}, error)
- func CheckEmptyCriticalSection(pass *analysis.Pass) (interface{}, error)
- func CheckExec(pass *analysis.Pass) (interface{}, error)
- func CheckExtremeComparison(pass *analysis.Pass) (interface{}, error)
- func CheckIneffectiveAppend(pass *analysis.Pass) (interface{}, error)
- func CheckIneffectiveCopy(pass *analysis.Pass) (interface{}, error)
- func CheckIneffectiveLoop(pass *analysis.Pass) (interface{}, error)
- func CheckInfiniteEmptyLoop(pass *analysis.Pass) (interface{}, error)
- func CheckInfiniteRecursion(pass *analysis.Pass) (interface{}, error)
- func CheckLeakyTimeTick(pass *analysis.Pass) (interface{}, error)
- func CheckLhsRhsIdentical(pass *analysis.Pass) (interface{}, error)
- func CheckLoopCondition(pass *analysis.Pass) (interface{}, error)
- func CheckLoopEmptyDefault(pass *analysis.Pass) (interface{}, error)
- func CheckMapBytesKey(pass *analysis.Pass) (interface{}, error)
- func CheckMissingEnumTypesInDeclaration(pass *analysis.Pass) (interface{}, error)
- func CheckNaNComparison(pass *analysis.Pass) (interface{}, error)
- func CheckNilContext(pass *analysis.Pass) (interface{}, error)
- func CheckNilMaps(pass *analysis.Pass) (interface{}, error)
- func CheckNonOctalFileMode(pass *analysis.Pass) (interface{}, error)
- func CheckPredeterminedBooleanExprs(pass *analysis.Pass) (interface{}, error)
- func CheckPureFunctions(pass *analysis.Pass) (interface{}, error)
- func CheckRangeStringRunes(pass *analysis.Pass) (interface{}, error)
- func CheckRepeatedIfElse(pass *analysis.Pass) (interface{}, error)
- func CheckScopedBreak(pass *analysis.Pass) (interface{}, error)
- func CheckSeeker(pass *analysis.Pass) (interface{}, error)
- func CheckSelfAssignment(pass *analysis.Pass) (interface{}, error)
- func CheckSillyBitwiseOps(pass *analysis.Pass) (interface{}, error)
- func CheckSillyRegexp(pass *analysis.Pass) (interface{}, error)
- func CheckSingleArgAppend(pass *analysis.Pass) (interface{}, error)
- func CheckStructTags(pass *analysis.Pass) (interface{}, error)
- func CheckTemplate(pass *analysis.Pass) (interface{}, error)
- func CheckTestMainExit(pass *analysis.Pass) (interface{}, error)
- func CheckTimeSleepConstant(pass *analysis.Pass) (interface{}, error)
- func CheckTimerResetReturnValue(pass *analysis.Pass) (interface{}, error)
- func CheckToLowerToUpperComparison(pass *analysis.Pass) (interface{}, error)
- func CheckUnreachableTypeCases(pass *analysis.Pass) (interface{}, error)
- func CheckUnreadVariableValues(pass *analysis.Pass) (interface{}, error)
- func CheckUnsafePrintf(pass *analysis.Pass) (interface{}, error)
- func CheckUntrappableSignal(pass *analysis.Pass) (interface{}, error)
- func CheckWaitgroupAdd(pass *analysis.Pass) (interface{}, error)
- func CheckWriterBufferModified(pass *analysis.Pass) (interface{}, error)
- func ConvertedFrom(v Value, typ string) bool
- func ConvertedFromInt(v Value) bool
- func IntValue(v Value, z vrp.Z) bool
- func InvalidUTF8(v Value) bool
- func Pointer(v Value) bool
- func UnbufferedChannel(v Value) bool
- func UniqueStringCutset(v Value) bool
- func ValidHostPort(v Value) bool
- func ValidateRegexp(v Value) error
- func ValidateTimeLayout(v Value) error
- func ValidateURL(v Value) error
- type Argument
- type Call
- type CallCheck
- type Value
Constants ¶
const ( MsgInvalidHostPort = "invalid port or service name in host:port pair" MsgInvalidUTF8 = "argument is not a valid UTF-8 encoded string" MsgNonUniqueCutset = "cutset contains duplicate characters" )
Variables ¶
var Analyzers = map[string]*analysis.Analyzer{ "SA1000": { Name: "SA1000", Run: callChecker(checkRegexpRules), Doc: Docs["SA1000"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA1001": { Name: "SA1001", Run: CheckTemplate, Doc: Docs["SA1001"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA1002": { Name: "SA1002", Run: callChecker(checkTimeParseRules), Doc: Docs["SA1002"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA1003": { Name: "SA1003", Run: callChecker(checkEncodingBinaryRules), Doc: Docs["SA1003"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA1004": { Name: "SA1004", Run: CheckTimeSleepConstant, Doc: Docs["SA1004"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA1005": { Name: "SA1005", Run: CheckExec, Doc: Docs["SA1005"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA1006": { Name: "SA1006", Run: CheckUnsafePrintf, Doc: Docs["SA1006"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA1007": { Name: "SA1007", Run: callChecker(checkURLsRules), Doc: Docs["SA1007"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA1008": { Name: "SA1008", Run: CheckCanonicalHeaderKey, Doc: Docs["SA1008"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA1010": { Name: "SA1010", Run: callChecker(checkRegexpFindAllRules), Doc: Docs["SA1010"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA1011": { Name: "SA1011", Run: callChecker(checkUTF8CutsetRules), Doc: Docs["SA1011"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA1012": { Name: "SA1012", Run: CheckNilContext, Doc: Docs["SA1012"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA1013": { Name: "SA1013", Run: CheckSeeker, Doc: Docs["SA1013"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA1014": { Name: "SA1014", Run: callChecker(checkUnmarshalPointerRules), Doc: Docs["SA1014"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA1015": { Name: "SA1015", Run: CheckLeakyTimeTick, Doc: Docs["SA1015"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer}, Flags: newFlagSet(), }, "SA1016": { Name: "SA1016", Run: CheckUntrappableSignal, Doc: Docs["SA1016"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA1017": { Name: "SA1017", Run: callChecker(checkUnbufferedSignalChanRules), Doc: Docs["SA1017"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA1018": { Name: "SA1018", Run: callChecker(checkStringsReplaceZeroRules), Doc: Docs["SA1018"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA1019": { Name: "SA1019", Run: CheckDeprecated, Doc: Docs["SA1019"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Deprecated}, Flags: newFlagSet(), }, "SA1020": { Name: "SA1020", Run: callChecker(checkListenAddressRules), Doc: Docs["SA1020"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA1021": { Name: "SA1021", Run: callChecker(checkBytesEqualIPRules), Doc: Docs["SA1021"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA1023": { Name: "SA1023", Run: CheckWriterBufferModified, Doc: Docs["SA1023"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer}, Flags: newFlagSet(), }, "SA1024": { Name: "SA1024", Run: callChecker(checkUniqueCutsetRules), Doc: Docs["SA1024"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA1025": { Name: "SA1025", Run: CheckTimerResetReturnValue, Doc: Docs["SA1025"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer}, Flags: newFlagSet(), }, "SA1026": { Name: "SA1026", Run: callChecker(checkUnsupportedMarshal), Doc: Docs["SA1026"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA1027": { Name: "SA1027", Run: callChecker(checkAtomicAlignment), Doc: Docs["SA1027"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA2000": { Name: "SA2000", Run: CheckWaitgroupAdd, Doc: Docs["SA2000"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA2001": { Name: "SA2001", Run: CheckEmptyCriticalSection, Doc: Docs["SA2001"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA2002": { Name: "SA2002", Run: CheckConcurrentTesting, Doc: Docs["SA2002"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer}, Flags: newFlagSet(), }, "SA2003": { Name: "SA2003", Run: CheckDeferLock, Doc: Docs["SA2003"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer}, Flags: newFlagSet(), }, "SA3000": { Name: "SA3000", Run: CheckTestMainExit, Doc: Docs["SA3000"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA3001": { Name: "SA3001", Run: CheckBenchmarkN, Doc: Docs["SA3001"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA4000": { Name: "SA4000", Run: CheckLhsRhsIdentical, Doc: Docs["SA4000"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer, facts.TokenFile, facts.Generated}, Flags: newFlagSet(), }, "SA4001": { Name: "SA4001", Run: CheckIneffectiveCopy, Doc: Docs["SA4001"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA4002": { Name: "SA4002", Run: CheckDiffSizeComparison, Doc: Docs["SA4002"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA4003": { Name: "SA4003", Run: CheckExtremeComparison, Doc: Docs["SA4003"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA4004": { Name: "SA4004", Run: CheckIneffectiveLoop, Doc: Docs["SA4004"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA4006": { Name: "SA4006", Run: CheckUnreadVariableValues, Doc: Docs["SA4006"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, facts.Generated}, Flags: newFlagSet(), }, "SA4008": { Name: "SA4008", Run: CheckLoopCondition, Doc: Docs["SA4008"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer}, Flags: newFlagSet(), }, "SA4009": { Name: "SA4009", Run: CheckArgOverwritten, Doc: Docs["SA4009"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer}, Flags: newFlagSet(), }, "SA4010": { Name: "SA4010", Run: CheckIneffectiveAppend, Doc: Docs["SA4010"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer}, Flags: newFlagSet(), }, "SA4011": { Name: "SA4011", Run: CheckScopedBreak, Doc: Docs["SA4011"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA4012": { Name: "SA4012", Run: CheckNaNComparison, Doc: Docs["SA4012"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer}, Flags: newFlagSet(), }, "SA4013": { Name: "SA4013", Run: CheckDoubleNegation, Doc: Docs["SA4013"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA4014": { Name: "SA4014", Run: CheckRepeatedIfElse, Doc: Docs["SA4014"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA4015": { Name: "SA4015", Run: callChecker(checkMathIntRules), Doc: Docs["SA4015"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA4016": { Name: "SA4016", Run: CheckSillyBitwiseOps, Doc: Docs["SA4016"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, facts.TokenFile}, Flags: newFlagSet(), }, "SA4017": { Name: "SA4017", Run: CheckPureFunctions, Doc: Docs["SA4017"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, facts.Purity}, Flags: newFlagSet(), }, "SA4018": { Name: "SA4018", Run: CheckSelfAssignment, Doc: Docs["SA4018"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated, facts.TokenFile}, Flags: newFlagSet(), }, "SA4019": { Name: "SA4019", Run: CheckDuplicateBuildConstraints, Doc: Docs["SA4019"].String(), Requires: []*analysis.Analyzer{facts.Generated}, Flags: newFlagSet(), }, "SA4020": { Name: "SA4020", Run: CheckUnreachableTypeCases, Doc: Docs["SA4020"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA4021": { Name: "SA4021", Run: CheckSingleArgAppend, Doc: Docs["SA4021"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated, facts.TokenFile}, Flags: newFlagSet(), }, "SA5000": { Name: "SA5000", Run: CheckNilMaps, Doc: Docs["SA5000"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer}, Flags: newFlagSet(), }, "SA5001": { Name: "SA5001", Run: CheckEarlyDefer, Doc: Docs["SA5001"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA5002": { Name: "SA5002", Run: CheckInfiniteEmptyLoop, Doc: Docs["SA5002"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA5003": { Name: "SA5003", Run: CheckDeferInInfiniteLoop, Doc: Docs["SA5003"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA5004": { Name: "SA5004", Run: CheckLoopEmptyDefault, Doc: Docs["SA5004"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA5005": { Name: "SA5005", Run: CheckCyclicFinalizer, Doc: Docs["SA5005"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer}, Flags: newFlagSet(), }, "SA5007": { Name: "SA5007", Run: CheckInfiniteRecursion, Doc: Docs["SA5007"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer}, Flags: newFlagSet(), }, "SA5008": { Name: "SA5008", Run: CheckStructTags, Doc: Docs["SA5008"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA5009": { Name: "SA5009", Run: callChecker(checkPrintfRules), Doc: Docs["SA5009"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA6000": { Name: "SA6000", Run: callChecker(checkRegexpMatchLoopRules), Doc: Docs["SA6000"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA6001": { Name: "SA6001", Run: CheckMapBytesKey, Doc: Docs["SA6001"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer}, Flags: newFlagSet(), }, "SA6002": { Name: "SA6002", Run: callChecker(checkSyncPoolValueRules), Doc: Docs["SA6002"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer}, Flags: newFlagSet(), }, "SA6003": { Name: "SA6003", Run: CheckRangeStringRunes, Doc: Docs["SA6003"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer}, Flags: newFlagSet(), }, "SA6005": { Name: "SA6005", Run: CheckToLowerToUpperComparison, Doc: Docs["SA6005"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA9001": { Name: "SA9001", Run: CheckDubiousDeferInChannelRangeLoop, Doc: Docs["SA9001"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA9002": { Name: "SA9002", Run: CheckNonOctalFileMode, Doc: Docs["SA9002"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA9003": { Name: "SA9003", Run: CheckEmptyBranch, Doc: Docs["SA9003"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, facts.TokenFile, facts.Generated}, Flags: newFlagSet(), }, "SA9004": { Name: "SA9004", Run: CheckMissingEnumTypesInDeclaration, Doc: Docs["SA9004"].String(), Requires: []*analysis.Analyzer{inspect.Analyzer}, Flags: newFlagSet(), }, "SA9005": { Name: "SA9005", Run: callChecker(checkNoopMarshal), Doc: Docs["SA9005"].String(), Requires: []*analysis.Analyzer{buildssa.Analyzer, valueRangesAnalyzer, facts.Generated, facts.TokenFile}, Flags: newFlagSet(), }, }
var Docs = map[string]*lint.Documentation{ "SA1000": &lint.Documentation{ Title: `Invalid regular expression`, Since: "2017.1", }, "SA1001": &lint.Documentation{ Title: `Invalid template`, Since: "2017.1", }, "SA1002": &lint.Documentation{ Title: `Invalid format in time.Parse`, Since: "2017.1", }, "SA1003": &lint.Documentation{ Title: `Unsupported argument to functions in encoding/binary`, Text: "" /* 302 byte string literal not displayed */, Since: "2017.1", }, "SA1004": &lint.Documentation{ Title: `Suspiciously small untyped constant in time.Sleep`, Text: "" /* 641 byte string literal not displayed */, Since: "2017.1", }, "SA1005": &lint.Documentation{ Title: `Invalid first argument to exec.Command`, Text: "" /* 678 byte string literal not displayed */, Since: "2017.1", }, "SA1006": &lint.Documentation{ Title: `Printf with dynamic first argument and no further arguments`, Text: "" /* 615 byte string literal not displayed */, Since: "2017.1", }, "SA1007": &lint.Documentation{ Title: `Invalid URL in net/url.Parse`, Since: "2017.1", }, "SA1008": &lint.Documentation{ Title: `Non-canonical key in http.Header map`, Text: "" /* 724 byte string literal not displayed */, Since: "2017.1", }, "SA1010": &lint.Documentation{ Title: `(*regexp.Regexp).FindAll called with n == 0, which will always return zero results`, Text: `If n >= 0, the function returns at most n matches/submatches. To return all results, specify a negative number.`, Since: "2017.1", }, "SA1011": &lint.Documentation{ Title: `Various methods in the strings package expect valid UTF-8, but invalid input is provided`, Since: "2017.1", }, "SA1012": &lint.Documentation{ Title: `A nil context.Context is being passed to a function, consider using context.TODO instead`, Since: "2017.1", }, "SA1013": &lint.Documentation{ Title: `io.Seeker.Seek is being called with the whence constant as the first argument, but it should be the second`, Since: "2017.1", }, "SA1014": &lint.Documentation{ Title: `Non-pointer value passed to Unmarshal or Decode`, Since: "2017.1", }, "SA1015": &lint.Documentation{ Title: "" /* 137 byte string literal not displayed */, Since: "2017.1", }, "SA1016": &lint.Documentation{ Title: `Trapping a signal that cannot be trapped`, Text: "" /* 269 byte string literal not displayed */, Since: "2017.1", }, "SA1017": &lint.Documentation{ Title: `Channels used with os/signal.Notify should be buffered`, Text: "" /* 384 byte string literal not displayed */, Since: "2017.1", }, "SA1018": &lint.Documentation{ Title: `strings.Replace called with n == 0, which does nothing`, Text: `With n == 0, zero instances will be replaced. To replace all instances, use a negative number, or use strings.ReplaceAll.`, Since: "2017.1", }, "SA1019": &lint.Documentation{ Title: `Using a deprecated function, variable, constant or field`, Since: "2017.1", }, "SA1020": &lint.Documentation{ Title: `Using an invalid host:port pair with a net.Listen-related function`, Since: "2017.1", }, "SA1021": &lint.Documentation{ Title: `Using bytes.Equal to compare two net.IP`, Text: "" /* 333 byte string literal not displayed */, Since: "2017.1", }, "SA1023": &lint.Documentation{ Title: `Modifying the buffer in an io.Writer implementation`, Text: `Write must not modify the slice data, even temporarily.`, Since: "2017.1", }, "SA1024": &lint.Documentation{ Title: `A string cutset contains duplicate characters`, Text: "" /* 396 byte string literal not displayed */, Since: "2017.1", }, "SA1025": &lint.Documentation{ Title: `It is not possible to use (*time.Timer).Reset's return value correctly`, Since: "2019.1", }, "SA1026": &lint.Documentation{ Title: `Cannot marshal channels or functions`, Since: "2019.2", }, "SA1027": &lint.Documentation{ Title: `Atomic access to 64-bit variable must be 64-bit aligned`, Text: "" /* 333 byte string literal not displayed */, Since: "2019.2", }, "SA2000": &lint.Documentation{ Title: `sync.WaitGroup.Add called inside the goroutine, leading to a race condition`, Since: "2017.1", }, "SA2001": &lint.Documentation{ Title: `Empty critical section, did you mean to defer the unlock?`, Text: "" /* 536 byte string literal not displayed */, Since: "2017.1", }, "SA2002": &lint.Documentation{ Title: `Called testing.T.FailNow or SkipNow in a goroutine, which isn't allowed`, Since: "2017.1", }, "SA2003": &lint.Documentation{ Title: `Deferred Lock right after locking, likely meant to defer Unlock instead`, Since: "2017.1", }, "SA3000": &lint.Documentation{ Title: `TestMain doesn't call os.Exit, hiding test failures`, Text: "" /* 357 byte string literal not displayed */, Since: "2017.1", }, "SA3001": &lint.Documentation{ Title: `Assigning to b.N in benchmarks distorts the results`, Text: "" /* 225 byte string literal not displayed */, Since: "2017.1", }, "SA4000": &lint.Documentation{ Title: `Boolean expression has identical expressions on both sides`, Since: "2017.1", }, "SA4001": &lint.Documentation{ Title: `&*x gets simplified to x, it does not copy x`, Since: "2017.1", }, "SA4002": &lint.Documentation{ Title: `Comparing strings with known different sizes has predictable results`, Since: "2017.1", }, "SA4003": &lint.Documentation{ Title: `Comparing unsigned values against negative values is pointless`, Since: "2017.1", }, "SA4004": &lint.Documentation{ Title: `The loop exits unconditionally after one iteration`, Since: "2017.1", }, "SA4005": &lint.Documentation{ Title: `Field assignment that will never be observed. Did you mean to use a pointer receiver?`, Since: "2017.1", }, "SA4006": &lint.Documentation{ Title: `A value assigned to a variable is never read before being overwritten. Forgotten error check or dead code?`, Since: "2017.1", }, "SA4008": &lint.Documentation{ Title: `The variable in the loop condition never changes, are you incrementing the wrong variable?`, Since: "2017.1", }, "SA4009": &lint.Documentation{ Title: `A function argument is overwritten before its first use`, Since: "2017.1", }, "SA4010": &lint.Documentation{ Title: `The result of append will never be observed anywhere`, Since: "2017.1", }, "SA4011": &lint.Documentation{ Title: `Break statement with no effect. Did you mean to break out of an outer loop?`, Since: "2017.1", }, "SA4012": &lint.Documentation{ Title: `Comparing a value against NaN even though no value is equal to NaN`, Since: "2017.1", }, "SA4013": &lint.Documentation{ Title: `Negating a boolean twice (!!b) is the same as writing b. This is either redundant, or a typo.`, Since: "2017.1", }, "SA4014": &lint.Documentation{ Title: "" /* 151 byte string literal not displayed */, Since: "2017.1", }, "SA4015": &lint.Documentation{ Title: `Calling functions like math.Ceil on floats converted from integers doesn't do anything useful`, Since: "2017.1", }, "SA4016": &lint.Documentation{ Title: `Certain bitwise operations, such as x ^ 0, do not do anything useful`, Since: "2017.1", }, "SA4017": &lint.Documentation{ Title: `A pure function's return value is discarded, making the call pointless`, Since: "2017.1", }, "SA4018": &lint.Documentation{ Title: `Self-assignment of variables`, Since: "2017.1", }, "SA4019": &lint.Documentation{ Title: `Multiple, identical build constraints in the same file`, Since: "2017.1", }, "SA4020": &lint.Documentation{ Title: `Unreachable case clause in a type switch`, Text: "" /* 1515 byte string literal not displayed */, Since: "2019.2", }, "SA4021": &lint.Documentation{ Title: `x = append(y) is equivalent to x = y`, Since: "2019.2", }, "SA5000": &lint.Documentation{ Title: `Assignment to nil map`, Since: "2017.1", }, "SA5001": &lint.Documentation{ Title: `Defering Close before checking for a possible error`, Since: "2017.1", }, "SA5002": &lint.Documentation{ Title: `The empty for loop (for {}) spins and can block the scheduler`, Since: "2017.1", }, "SA5003": &lint.Documentation{ Title: `Defers in infinite loops will never execute`, Text: "" /* 174 byte string literal not displayed */, Since: "2017.1", }, "SA5004": &lint.Documentation{ Title: `for { select { ... with an empty default branch spins`, Since: "2017.1", }, "SA5005": &lint.Documentation{ Title: `The finalizer references the finalized object, preventing garbage collection`, Text: "" /* 656 byte string literal not displayed */, Since: "2017.1", }, "SA5006": &lint.Documentation{ Title: `Slice index out of bounds`, Since: "2017.1", }, "SA5007": &lint.Documentation{ Title: `Infinite recursive call`, Text: "" /* 447 byte string literal not displayed */, Since: "2017.1", }, "SA5008": &lint.Documentation{ Title: `Invalid struct tag`, Since: "2019.2", }, "SA5009": &lint.Documentation{ Title: `Invalid Printf call`, Since: "2019.2", }, "SA6000": &lint.Documentation{ Title: `Using regexp.Match or related in a loop, should use regexp.Compile`, Since: "2017.1", }, "SA6001": &lint.Documentation{ Title: `Missing an optimization opportunity when indexing maps by byte slices`, Text: "" /* 810 byte string literal not displayed */, Since: "2017.1", }, "SA6002": &lint.Documentation{ Title: `Storing non-pointer values in sync.Pool allocates memory`, Text: "" /* 596 byte string literal not displayed */, Since: "2017.1", }, "SA6003": &lint.Documentation{ Title: `Converting a string to a slice of runes before ranging over it`, Text: "" /* 579 byte string literal not displayed */, Since: "2017.1", }, "SA6005": &lint.Documentation{ Title: `Inefficient string comparison with strings.ToLower or strings.ToUpper`, Text: "" /* 773 byte string literal not displayed */, Since: "2019.2", }, "SA9001": &lint.Documentation{ Title: `Defers in range loops may not run when you expect them to`, Since: "2017.1", }, "SA9002": &lint.Documentation{ Title: `Using a non-octal os.FileMode that looks like it was meant to be in octal.`, Since: "2017.1", }, "SA9003": &lint.Documentation{ Title: `Empty body in an if or else branch`, Since: "2017.1", }, "SA9004": &lint.Documentation{ Title: `Only the first constant has an explicit type`, Text: "" /* 1671 byte string literal not displayed */, Since: "2019.1", }, "SA9005": &lint.Documentation{ Title: `Trying to marshal a struct with no public fields nor custom marshaling`, Text: "" /* 358 byte string literal not displayed */, Since: "2019.2", }, }
Functions ¶
func CanBinaryMarshal ¶
func CheckArgOverwritten ¶
func CheckBenchmarkN ¶
func CheckCanonicalHeaderKey ¶
func CheckConcurrentTesting ¶
func CheckCyclicFinalizer ¶
func CheckDeferInInfiniteLoop ¶
func CheckDeferLock ¶
func CheckDeprecated ¶
func CheckDiffSizeComparison ¶
func CheckDoubleNegation ¶
func CheckDubiousDeferInChannelRangeLoop ¶
func CheckDuplicateBuildConstraints ¶
func CheckEarlyDefer ¶
func CheckEmptyBranch ¶
func CheckEmptyCriticalSection ¶
func CheckExec ¶
func CheckExtremeComparison ¶
func CheckIneffectiveAppend ¶
func CheckIneffectiveCopy ¶
func CheckIneffectiveLoop ¶
func CheckInfiniteEmptyLoop ¶
func CheckInfiniteRecursion ¶
func CheckLeakyTimeTick ¶
func CheckLhsRhsIdentical ¶
func CheckLoopCondition ¶
func CheckLoopEmptyDefault ¶
func CheckMapBytesKey ¶
func CheckMissingEnumTypesInDeclaration ¶
func CheckNaNComparison ¶
func CheckNilContext ¶
func CheckNilMaps ¶
func CheckNonOctalFileMode ¶
func CheckPredeterminedBooleanExprs ¶
func CheckPureFunctions ¶
func CheckRangeStringRunes ¶
func CheckRepeatedIfElse ¶
func CheckScopedBreak ¶
func CheckSeeker ¶
func CheckSelfAssignment ¶
func CheckSillyBitwiseOps ¶
func CheckSillyRegexp ¶
func CheckSingleArgAppend ¶
func CheckStructTags ¶
func CheckTemplate ¶
func CheckTestMainExit ¶
func CheckTimeSleepConstant ¶
func CheckTimerResetReturnValue ¶
func CheckToLowerToUpperComparison ¶
func CheckUnreachableTypeCases ¶
func CheckUnreadVariableValues ¶
func CheckUnsafePrintf ¶
func CheckUntrappableSignal ¶
func CheckWaitgroupAdd ¶
func CheckWriterBufferModified ¶
func ConvertedFrom ¶
ConvertedFrom reports whether value v was converted from type typ.
func ConvertedFromInt ¶
func IntValue ¶
func InvalidUTF8 ¶
func Pointer ¶
func UnbufferedChannel ¶
func UniqueStringCutset ¶
func ValidHostPort ¶
func ValidateRegexp ¶
func ValidateTimeLayout ¶
func ValidateURL ¶
Types ¶
type Argument ¶
type Argument struct { Value Value // contains filtered or unexported fields }
func (*Argument) Invalid ¶
type Call ¶
type Call struct { Pass *analysis.Pass Instr ssa.CallInstruction Args []*Argument Parent *ssa.Function // contains filtered or unexported fields }
func (*Call) Invalid ¶
type CallCheck ¶
type CallCheck func(call *Call)
func RepeatZeroTimes ¶
type Value ¶
Source Files ¶
analysis.go buildtag.go doc.go knowledge.go lint.go rules.go structtag.go
Directories ¶
Path | Synopsis |
---|---|
staticcheck/vrp |
- Version
- v0.0.0-2019.2
- Published
- Jun 24, 2019
- Platform
- windows/amd64
- Imports
- 38 packages
- Last checked
- 9 minutes ago –
Tools for package owners.