# Go Errors

> Go error handling patterns. Routes to specific patterns. Use when this capability is needed.

- Skill: `tomevault-io/go-errors` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/go-errors`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/go-errors/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/go-errors

---


# Go Error Handling

## Route by Need
- Wrapping errors with context → see [wrapping/](wrapping/)
- Defining sentinel errors → see [sentinel/](sentinel/)
- Checking error types → see [checking/](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
- [wrapping/](wrapping/) - Add context with fmt.Errorf %w
- [sentinel/](sentinel/) - Define package-level errors
- [checking/](checking/) - Type-safe error inspection

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/jamesprial) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-13 -->

