package main import sync func main wg sync WaitGroup for 10 go func de

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
package main
import "sync"
func main() {
wg := sync.WaitGroup{}
for i := 0; i < 10; i++ {
go func() {
defer wg.Done()
println(i)
}()
}
}