
Go Error Handling
Go error strategy guide covering sentinel errors, custom types, and %w versus %v wrapping choices.
- skills.sh installs
- 1.4K
- GitHub stars
- 196
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers choosing between sentinel errors, typed errors, and opaque errors, plus when to wrap with
%wversus%v - Includes a check script (
check-errors.sh) that flags string-based error matching, bare propagation, and log-and-return patterns - Enforces handling each error once, either logging or returning it, and never discarding errors with
_without a comment - Designed for Go developers writing error flow across package boundaries who need
errors.Isanderrors.Asto work reliably
Install
$ npx -y skills add cxuu/golang-skills --skill go-error-handling -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
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
Details
- Repository
- github.com/cxuu/golang-skills
- Categories
- Go, Code Review & Quality
- First seen
- May 16, 2026
More from cxuu/golang-skills
All 20- Go Concurrency1.4K
- Go Linting1.4K
- Go Interfaces1.4K
- Go Documentation1.3K
- Go Style Core1.3K
- Go Performance1.3K
- Go Context1.3K
- Go Naming1.3K
- Go Defensive1.3K
- Go Packages1.3K
- Go Functional Options1.3K
- Go Data Structures1.3K
- Go Control Flow1.3K
- Go Logging1.1K
- Go Functions1.1K
- Go Generics1.1K
- Go Declarations1.1K
- Go Code Review1.8K
- Go Testing1.4K
Similar to Go Error Handling
More Go
golang-error-handlingsamber/cc-skills-golang45.9K installsIdiomatic Go error handling covering wrapping, inspection, the single handling rule, and production-grade slog and samber/oops logging.
go-control-flowcxuu/golang-skills1.3K installsGo conditionals, loops, and switch statements with guard clauses, scoped initialization, and blank identifier patterns.
error-handlingaffaan-m/ecc6.3K installsPatterns for typed errors, retries, circuit breakers, and user-facing failure messages across TypeScript, Python, and Go.
go-loggingcxuu/golang-skills1.1K installsStructured Go logging guide for slog, log levels, request-scoped context, and what to keep out of logs.
golang-samber-oopssamber/cc-skills-golang40K installsStructured error handling in Go with samber/oops: builder chains, stack traces, error codes, and panic recovery.