package main
import (
"fmt"
"sync"
)
func main() {
q := []string{"1", "2"}
wg := new(sync.WaitGroup)
for _, val := range q {
wg.Add(1)
go func(){
fmt.Println(val)
wg.Done()
}()
}
wg.Wait()
}
package main
import (
"fmt"
"sync"
)
func main() {
q := []string{"1", "2"}
wg := new(sync.WaitGroup)
for _, val := range q {
wg.Add(1)
go func(tVal string){
fmt.Println(tVal)
wg.Done()
}(val)
}
wg.Wait()
}