Multitasking, Golang, Software Development, Concurrency, Parallel Computing.
}() // Goroutine 2. wg.Add(1) go func() { defer wg.Done() // Perform some work in the second goroutine. fmt.Println("Goroutine 2.") result := <-ch fmt.Println("Result from Goroutine 1:", result) }() // Wait for both goroutines to finish. wg.Wait() // Close the channel. close(ch) } In this example,