Inspectopedia Help

Unused function or method call result

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

An API of such functions imply that users should call them mostly to get a return value and process it, not for side effects. Calls that do not handle the result could be an indication of a misuse of the API.

Example:

fmt.Errorf("error: %s", reason) // constructed error is ignored

After the Introduce local variable quick-fix is applied:

err := fmt.Errorf("error: %s", reason)

Inspection options

Option

Type

Default

Reported functions/methods

Table

None

Import Path

TableColumn

[fmt, fmt, errors, sort, fmt]

Function Name

TableColumn

[Errorf, Sprintf, New, Reverse, Sprint]

String methods

StringList

[Error, String]

Inspection Details

Available in:

GoLand 2023.3

Plugin:

Go, 233.SNAPSHOT

Last modified: 13 July 2023