Last Updated: May 22, 2026
A goroutine started with go runs independently of the code that launched it. The launcher keeps going, the goroutine keeps going, and unless the launcher waits, the program might exit before any of its workers finish. sync.WaitGroup is the standard way to wait for a known number of goroutines to complete before moving on.