Agent skill
go-errors
Go error handling patterns. Routes to specific patterns.
Stars
163
Forks
31
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/testing/go-errors
SKILL.md
Go Error Handling
Route by Need
- Wrapping errors with context → see wrapping/
- Defining sentinel errors → see sentinel/
- Checking error types → see checking/
Quick Check
- Never ignore errors (_ = fn())
- Wrap with context at boundaries
- Use errors.Is/As, not ==
Common Pattern
go
func ProcessFile(path string) error {
f, err := os.Open(path)
if err != nil {
return fmt.Errorf("open %s: %w", path, err)
}
defer f.Close()
if err := parse(f); err != nil {
return fmt.Errorf("parse %s: %w", path, err)
}
return nil
}
Resources
Didn't find tool you were looking for?