Go example: goroutines and WaitGroup
Run concurrent work with goroutines and a sync.WaitGroup in Go.
Shows Go concurrency basics. It launches five goroutines with the go keyword, each computing a square and writing to its own index of a shared slice. A sync.WaitGroup tracks the outstanding work: wg.Add(1) before each goroutine, defer wg.Done() inside it, and wg.Wait() blocks main until all goroutines finish before the results are printed.