Skip to content

nil-error-return

Detect nil errors returned from branches that prove an error is non-nil.

Updated View as Markdown

Default severity: error

Reports explicit nil error results inside a branch entered because an error is non-nil. Returning success there silently discards the failure.

Bad

if err != nil { return nil, nil }

Good

if err != nil { return nil, err }
Navigation

Type to search…

↑↓ navigate↵ selectEsc close