Skip to main content

What it flags

defer resp.Body.Close(), or defer rows.Close() after Query/QueryContext, runs before the call’s error result is checked, whatever the error variable is named, so a failed call defers Close on a nil value and panics. os.Open files are accepted, since Close on a nil *os.File returns an error instead.

Configuration

Set the rule to "off" in loadwise.config.json to drop its findings: