Go 1 · Code patterns
Handle and wrap errors
Return errors, wrapping them with context so callers can inspect the cause with errors.Is and errors.As.
if err != nil {
return fmt.Errorf("load config: %w", err)
}
Go 1 · Code patterns
Return errors, wrapping them with context so callers can inspect the cause with errors.Is and errors.As.
if err != nil {
return fmt.Errorf("load config: %w", err)
}
Was this page helpful?