loom-golang

Solid

Go language expertise for idiomatic, production-quality code. Use for Go development, concurrency patterns with goroutines and channels, error handling, testing, and module management following Effective Go principles.

Testing & QA 53 stars 0 forks Updated today MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
58
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Go Language Expertise ## Overview Idiomatic, production-grade Go: concurrency, error handling, interfaces, testing, and version-gated behavior. The Foundations below get code working; the **Expert Practices** section is the higher bar — each item states the *mechanism* so you can apply it beyond the case shown. ## Foundations ### Error Handling ```go // Sentinel errors for identity checks; custom types for structured context. var ErrNotFound = errors.New("resource not found") type ValidationError struct{ Field, Message string } func (e *ValidationError) Error() string { return fmt.Sprintf("validation on %s: %s", e.Field, e.Message) } func fetchUser(id string) (*User, error) { u, err := db.GetUser(id) if err != nil { if errors.Is(err, sql.ErrNoRows) { return nil, fmt.Errorf("user %s: %w", id, ErrNotFound) // wrap w/ %w } return nil, fmt.Errorf("fetching user %s: %w", id, err) } return u, nil } // errors.Is matches by identity down the %w chain; errors.As extracts a type. var ve *ValidationError if errors.As(err, &ve) { /* ve.Field, ve.Message */ } ``` `%w` vs `%v` is an API decision — see Expert Practices. ### Concurrency ```go // Worker pool. Go 1.25+: wg.Go does Add(1)+launch+Done atomically (see Expert). func workerPool(jobs <-chan Job, results chan<- Result, n int) { var wg sync.WaitGroup for range n { wg.Go(func() { // pre-1.25: wg.Add(1); go func(){ defer wg.Done(); ... }() ...

Details

Author
cosmix
Repository
cosmix/loom
Created
8 months ago
Last Updated
today
Language
Rust
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category