go-concurrency

Solid

Use when: writing or reviewing Go concurrency — goroutines, channels, golang.org/x/sync/errgroup, context propagation and cancellation, sync.WaitGroup vs channels, the -race detector, or diagnosing goroutine leaks (incl. the 1.26 goroutineleak profile). Do NOT use for: sequential error handling / slog / generics / interface style (use go-core-idioms), non-Go languages, framework-specific code.

AI & Automation 22 stars 3 forks Updated 2 days ago MIT

Install

View on GitHub

Quality Score: 88/100

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

Skill Content

# Go Concurrency Goroutines, channels, `context`, and `errgroup` for Go 1.26 — plus the number-one documented pitfall: **leaking goroutines on an unbuffered channel + early return.** ## Agent Workflow (MANDATORY) Before ANY implementation, use `TeamCreate` to spawn 3 agents: 1. **fuse-ai-pilot:explore-codebase** - Map existing goroutine/channel/context usage 2. **fuse-ai-pilot:research-expert** - Verify errgroup/context docs via Context7/Exa 3. **mcp__context7__query-docs** - Confirm `golang.org/x/sync/errgroup` signatures After implementation, run **fuse-ai-pilot:sniper** for validation, and run tests with `go test -race ./...`. --- ## Overview | Feature | Description | |---------|-------------| | **Goroutines & channels** | Lightweight concurrency + typed communication | | **errgroup** | Parallelism + error aggregation + context cancellation | | **context** | First param, propagated strictly, carries cancellation/deadline | | **WaitGroup vs channels** | Counting-only vs result/error passing | | **Race detector** | `-race` in tests/CI to catch data races | | **Leak profile (1.26)** | `GOEXPERIMENT=goroutineleakprofile` / `/debug/pprof/goroutineleak` | --- ## Critical Rules 1. **`context.Context` is the first parameter** - named `ctx`, never stored in a struct 2. **Every started goroutine must be able to exit** - or it leaks (see rule 4) 3. **Prefer `errgroup` for fan-out with errors** - it handles wait + first error + cancel 4. **Unbuffered channel + early return ...

Details

Author
fusengine
Repository
fusengine/agents
Created
6 months ago
Last Updated
2 days ago
Language
TypeScript
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category