This is the function we'll run in every goroutine.
(id int)
| 11 | |
| 12 | // This is the function we'll run in every goroutine. |
| 13 | func worker(id int) { |
| 14 | fmt.Printf("Worker %d starting\n", id) |
| 15 | |
| 16 | // Sleep to simulate an expensive task. |
| 17 | time.Sleep(time.Second) |
| 18 | fmt.Printf("Worker %d done\n", id) |
| 19 | } |
| 20 | |
| 21 | func main() { |
| 22 |