Ignoring when to wrap an error

Mistake

Returning errors without context.

Fix

Wrap errors and provide context

if err != nil {
  return fmt.Errorf("bar failed: %w", err)
}

References