3 ms·
> This means you can't pass variables in as function arguments. Well, you could... for _, url := range urls { wg.Go(func(u string) func() {
by 9rx 1y ago
> This means you can't pass variables in as function arguments.
Well, you could...
for _, url := range urls {
wg.Go(func(u string) func() {
return func() {
http.Get(u)
}
}(url))
}
> You need to use this pattern instead
Why? Seems rather redundant. It is not like WaitGroup.Go exists in earlier versions.