mirror of
https://gitee.com/johng/gf.git
synced 2024-12-03 20:58:47 +08:00
19 lines
191 B
Go
19 lines
191 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"sync"
|
|
)
|
|
|
|
func main() {
|
|
wg := sync.WaitGroup{}
|
|
for i := 0; i < 10; i++ {
|
|
wg.Add(1)
|
|
go func(v int) {
|
|
fmt.Println(v)
|
|
wg.Done()
|
|
}(i)
|
|
}
|
|
wg.Wait()
|
|
}
|