What problem does it solve?
It prevents fragile, inconsistent, and noisy error handling in Go by enforcing idiomatic wrapping, inspection, and safe logging practices that remain useful with log aggregation at scale.
Core Features & Use Cases
- Idiomatically wrap and inspect errors: Use
fmt.Errorf with %w and rely on errors.Is / errors.As (or errors.AsType) so error chains stay traversable across layers.
- Avoid duplicate noise and swallowed failures: Enforce the single handling rule so errors are either logged or returned, never both, and never silently discarded.
- Production-ready structured logging guidance: Prefer
slog with low-cardinality messages and structured attributes, plus HTTP request logging patterns.
- Use sentinel errors, custom error types, and
errors.Join: Model expected conditions with sentinels, carry structured data with custom types, and combine independent failures cleanly.
- Use
samber/oops for production errors: Add stack traces and structured context without leaking sensitive details to end users.
Quick Start
Apply this skill when creating, wrapping, inspecting, or logging errors in your Go code, following the rules for lowercase error strings, %w wrapping, chain inspection, and single-handling (return-only or log-only) at each layer.