Go को goroutines र channels ले well-established concurrency patterns को एक समूह सक्षम गर्छ जसले सामान्य समस्याहरू समाधान गर्छ — work distribute गर्ने, fanning out/in, pipelines, र rate limiting। यी idiomatic patterns जान्दा तपाई सही र efficient concurrent systems बनाउन सक्नुहुन्छ।
Worker pool — bounded concurrency
{
wg sync.WaitGroup
w := ; w < numWorkers; w++ {
wg.Add()
{
wg.Done()
job := jobs {
results <- process(job)
}
}()
}
wg.Wait()
(results)
}
