What problem does it solve?
Go programs often struggle with scalable error handling as codebases grow. This skill presents patterns for multi-error wrapping, preserving context, and integrating structured logging to improve reliability and debuggability.
Core Features & Use Cases
- Multi-error wrapping with errors.Join to preserve all failure causes.
- Wrapping with multiple %w in fmt.Errorf to retain rich context across layers.
- Correct unwrap semantics and guidance to use errors.Is / errors.As for robust error checks.
- Slog integration patterns for consistent, structured logging across services.
- Use case: when aggregating results from several calls, this skill helps you return a single, rich error that preserves all underlying causes.
Quick Start
Review and apply the patterns to existing Go code: replace plain error returns with errors.Join where appropriate, adopt %w wrapping for context, implement errors.Is/errors.As checks in call sites, and align logging with slog for observability.