Go Error Handling Patterns
Implements idiomatic, production-ready Go error handling patterns based on Google and Uber style guides.
This skill provides comprehensive guidance for managing errors in Go applications, ensuring your code follows industry best practices for Go 1.13+. It helps developers navigate complex decisions between sentinel errors, custom types, and error wrapping using %w and %v while maintaining clean control flows through early returns. By integrating automated scripts to detect anti-patterns—such as string comparisons on errors or the redundant 'log-and-return' pattern—this skill ensures that your Go services are robust, debuggable, and maintainable across package boundaries.
Key Features
0177 GitHub stars
02Automated detection of error handling anti-patterns via CLI
03Best practices for Go 1.21+ structured logging with slog
04Sentinel error and custom error type implementation patterns
05Idiomatic error wrapping logic using %w and %v
06Standardized guidance on error flow and early returns
Use Cases
01Implementing cross-package error propagation using errors.Is and errors.As
02Refactoring legacy Go codebases to modern error handling standards
03Designing robust API boundaries to prevent internal implementation leakage