Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Guides Go concurrency design, covering goroutine lifecycles, channels, sync primitives, errgroup, singleflight, worker pools and pipelines.
78% 91%+13 ptsof test cases passed
Passed 21 of 23 test cases with the skill, and 18 of 23 without it.
3 of 3 safety checks passed
Not used yet
time.After in Hot LoopsNEVER start a goroutine without knowing how it stops. Every goroutine MUST answer: how will it stop?
// ✗ Bad — fire-and-forget, no way to stop or wait
func startWorker() {
go func() {
for {
doWork() // runs forever, leaks on shutdown
}
}()
}
// ✓ Good — goroutine respects context cancellation, caller can wait
func startWorker(ctx context.Context) *sync.WaitGroup {
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
for {
select {
case <-ctx.Done():
return
default:
doWork(ctx)
}
}
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.