WaitGroup.Wait blocks the calling goroutine until every task registered with the wait group has completed. Pair each launched goroutine with wg.Add(1) before starting it and wg.Done when it finishes; deferring Done reduces the chance of leaving Wait blocked. section 5.2.1
Figure 5.1 Start multiple workers and wait for completion.
The worker timeline shows how multiple goroutines start and how Wait releases the caller only after completion. section 5.2.1
Parallel file compression
A parallel compressor calls wg.Add(1) for each filename, passes that filename into the goroutine, calls compress, then calls wg.Done. After the loop, wg.Wait ensures the completion message is printed only after all files finish. Passing the filename as a parameter prevents scheduled goroutines from observing a later loop value. section 5.2.1
