Go 1.27 reference · 3 entries

Go Concurrency

Run goroutines with WaitGroup, protect data with Mutex and Once, and communicate with channels and select.

NameDescriptionSince
sync.WaitGroup Wait for a group of goroutines to finish; WaitGroup.Go (Go 1.25+) starts a goroutine and tracks it in one call. 1.25
sync.Mutex and sync.Once Protect shared data so only one goroutine accesses it at a time, and run initialisation exactly once.
chan, select and close Send values between goroutines with channels, wait on several with select, and close a channel to end range loops.

Was this page helpful?