Canonical guidance

Use when

Avoid

Preferred pattern

u, err := repo.Fetch(ctx, id)
if err != nil {
	return User{}, fmt.Errorf("fetch user %q: %w", id, err)
}
return u, nil

Anti-pattern

u, _ := repo.Fetch(ctx, id)

Explanation: This anti-pattern is tempting in prototypes, but ignored errors destroy observability and push failures into harder-to-debug states.

Why

Related pages

Sources