Canonical guidance

Use when

Avoid

Preferred pattern

if err1 != nil || err2 != nil {
	return errors.Join(err1, err2)
}
return nil

Anti-pattern

Explanation: This anti-pattern is tempting because it is quick, but callers lose structured inspection.

Why

Related pages

Sources