go-sync-primitives
Installation
SKILL.md
Sync Primitives
sync.WaitGroup - Wait for Goroutines
CORRECT
func processBatch(items []string) {
var wg sync.WaitGroup
for _, item := range items {
wg.Add(1) // BEFORE launching goroutine
go func(item string) {
defer wg.Done()
process(item)
}(item)
}