← ClaudeAtlas

golisted

This skill should be used when the user works with Go files (.go), asks about "error handling", "interfaces", "goroutines", "channels", "packages", or discusses Go idioms and concurrency. Provides patterns for error handling, interface design, concurrency, and package organization.
dean0x/devflow · ★ 19 · Code & Development · score 80
Install: claude install-skill dean0x/devflow
# Go Patterns Reference for Go-specific patterns, idioms, and best practices. Full bibliography: `references/sources.md`. ## Iron Law > **ERRORS ARE VALUES** [5][7] > > Never ignore errors. `if err != nil` is correctness, not boilerplate. Every error > return must be checked, wrapped with context, or explicitly documented as intentionally > ignored with `_ = fn()`. "Errors are values. Values can be programmed." — Rob Pike [5] ## When This Skill Activates Working with Go codebases — error handling, interfaces, goroutines, channels, packages. --- ## Error Handling [5][6] ```go // BAD: return err — caller loses context // GOOD: return fmt.Errorf("reading config %s: %w", path, err) var ErrNotFound = errors.New("not found") func FindUser(id string) (*User, error) { u, err := db.Get(id) if err != nil { return nil, fmt.Errorf("finding user %s: %w", id, err) } if u == nil { return nil, ErrNotFound } return u, nil } // Caller: if errors.Is(err, ErrNotFound) { ... } ``` --- ## Interface Design [7][14] ```go // "The bigger the interface, the weaker the abstraction" — Rob Pike [7] // BAD: func NewService(repo *PostgresRepo) *Service // GOOD: func NewService(repo Repository) *Service — accept interfaces [14] // Small interfaces compose cleanly [1] type Reader interface { Read(p []byte) (n int, err error) } type Writer interface { Write(p []byte) (n int, err error) } type ReadWriter interface { Reader; Writer } ``` --- ## Concurrency [9][10][13]