Multitasking, Golang, Software Development, Concurrency, Parallel Computing.
completed\n", id) } func main() { const numWorkers = 3 // Create an instance of WaitGroup var wg sync.WaitGroup fmt.Println("Main started") // Increment the counter for the goroutines. for i := 1; i <= numWorkers; i++ { wg.Add(1) go worker(i, &wg) } // Block execution until all goroutines finish.