Inspectopedia Help

Probable bugs

'FailNow' in a non-test goroutine  

Reports calls to testing.T.FailNow and similar methods located in goroutines in test files.

'Unmarshal' is called with the incorrect argument  

Reports calls to json.Unmarshal and similar functions if the argument that is passed to store the result is not a pointer or an interface.

'context.CancelFunc' is not called  

Reports execution paths that do not call the cancel function returned by context.WithCancel and similar functions.

Defer/go statement calls 'recover' or 'panic' directly  

Reports defer and go statements that call panic() or recover() directly.

Direct comparison of errors  

Reports direct comparison of errors, for example, using ==, and suggests using errors.Is instead.

Division by zero  

Reports division by zero.

Exceeded shift expression  

Reports shift expressions that equal or exceed the width of the integer.

Imported package name as a name identifier  

Reports declarations of variables, arguments or functions that overlap with the used import.

Impossible interface type assertion  

Reports impossible interface-to-interface type assertions.

Incorrect 'strings.Replace' count argument  

Reports strings.Replace calls with the replace count 0 instead of -1.

Incorrect usage of 'fmt.Printf' and 'fmt.Println' functions  

Reports incorrect usages of fmt.Printf, fmt.Println, and similar formatting and printing functions.

Incorrect usage of the 'errors.As' function  

Reports calls of the errors.As function when the second argument is not a pointer to an interface or to a type that implements an error.

Incorrect usage of the 'sync/atomic' package  

Reports assignment statements of the form x = atomic.AddUint64(&x, 1).

Integer to string type conversion  

Reports conversions of string(x)-alike expressions where x is an integer but not byte or rune.

Invalid conversions of 'uintptr' to 'unsafe.Pointer'  

Reports possibly incorrect conversions of uintptr to unsafe.Pointer.

Irregular usage of 'iota'  

Reports irregular usage of iota within a constant declaration.

Leading whitespace in directive comment  

Reports leading whitespaces before Go directives in comments.

Locks mistakenly passed by value  

Reports locks that are mistakenly passed by values.

Loop variables captured by the func literal  

Reports references to loop variables from within func literals in defer and go statements.

Malformed build tag  

Reports malformed build tags and build tags in the incorrect location.

Malformed struct tag  

Reports struct tags that do not conform to Go conventions for struct tags.

Missing 'case' statements for 'iota' consts in 'switch'  

Reports unhandled values in switch statements when the iota identifier is in the const declaration.

Mixed value and pointer receivers  

Reports structures with methods that use a mixture of types: value and pointer receivers.

Nilness analyzer  

Reports problems caused by incorrect usage of the nil value.

Non-standard signature for well-known function names  

Reports methods with certain names in the following cases: the method's name matches the name of several well-known interface methods from the standard library the signature does not match the signature of the corresponding interface method Such methods might indicate that the receiver type is intended to satisfy an interface from the standard library, but fails to do so because of the mistake in the method's signature.

Reserved word used as name  

Reports declarations of variables, arguments or functions that overlap with the built-in or reserved keyword.

Shadowing variable  

Reports declarations of variables that overlap with the declarations in the outer scope.

Type assertion on errors fails on wrapped errors  

Reports type assertion or type switch on errors, for example, err.(*MyErr) or switch err.(type), and suggests using errors.As instead.

Unhandled error  

Reports calls to functions and methods that do not handle the call result of the error type.

Unused function or method call result  

Reports calls to certain functions and methods that do not handle a call result.

Last modified: 18 June 2024