
Go Error Handling
Handles the full spectrum of Go error patterns: choosing between sentinel errors, custom types, and fmt.Errorf wrapping (%w vs %v), structuring error flow with early returns, and deciding whether to log or return (never both). Ships with a linter script that catches common anti-patterns like string comparison on err.Error() and log-and-return violations. The references cover wrapping strategy at package boundaries, when to escalate from simple errors.New to typed errors, and the handle-once pattern. Requires Go 1.13+ for errors.Is/As. Built from Google and Uber style guides, so you get opinionated guidance on things like error string capitalization and avoiding in-band error values.
- skills.sh installs
- 1.3K
- GitHub stars
- 193
- last updated
- Aug 21, 2026
Install
$ npx -y skills add cxuu/golang-skills --skill go-error-handling --agent claude-codeInstalls into .claude/skills of the current project.
Files
Go Error Handling
Compatibility:
errors.Is,errors.As, and%wwrapping require Go 1.13+; structured logging examples may uselog/slogfrom Go 1.21+.
Resource Routing
scripts/check-errors.sh- Run when checking string-based error matching, bare error propagation, and log-and-return patterns.scripts/check-errors-ast.go- Implementation helper invoked bycheck-errors.sh; patch this when changing error-flow analysis behavior.references/ERROR-FLOW.md- Read when deciding where to handle, wrap, log, or return errors.references/ERROR-TYPES.md- Read when choosing sentinel errors, typed errors, or opaque errors.references/WRAPPING.md- Read when choosing%wversus%vor crossing package boundaries.
In Go, errors are values — they are created by code and consumed by code.
Choosing an Error Strategy
Sponsors
Details
- Repository
- github.com/cxuu/golang-skills
- Categories
- Documentation, Debugging, Go
- First seen
- May 16, 2026
More from cxuu/golang-skills
All 20- Go Linting1.3K
- Go Concurrency1.3K
- Go Interfaces1.3K
- Go Documentation1.3K
- Go Style Core1.3K
- Go Performance1.3K
- Go Context1.3K
- Go Naming1.3K
- Go Defensive1.3K
- Go Packages1.3K
- Go Data Structures1.3K
- Go Functional Options1.3K
- Go Control Flow1.3K
- Go Logging1.1K
- Go Functions1.1K
- Go Generics1.1K
- Go Declarations1.1K
- Go Code Review1.8K
- Go Testing1.4K