func main() { for i := 0; i < 10; i++ { go work(i) } time.Sleep(3 * time.Second) // they should be done by now }