Recently, I have been watching golang’s tour. I have always wondered how to start multiple tours.
The online tutorial or demo is to open Ctrip directly through go func (), then how to open multiple synergetic programs?
Opening positions for 100 rounds:
package main import ( "fmt" "sync" ) var w sync.WaitGroup func main() { for i := 0; i < 100; i++ { w.Add(1) go func(n int) { fmt.Println(n) w.Done() }(i) } //Wait for the completion of one hundred coordination trips. w.Wait() }