Skip to content

swapped-errors-is-arguments

Detect likely reversed errors.Is arguments.

Updated View as Markdown

Default severity: error

errors.Is expects the error being inspected first and the target sentinel second. A package-level sentinel from another package in the first position, followed by a local error value, usually means the arguments were reversed.

Bad

errors.Is(io.EOF, err)

Good

errors.Is(err, io.EOF)
Navigation

Type to search…

↑↓ navigate↵ selectEsc close