Hello,
In the following example: https://play.golang.org/p/yz_ifHC-Hut
for _, onedoer := range d {
go onedoer.do(&wg)
}
Should I pass the function onedoer.do as a parameter of the go
routine: https://play.golang.org/p/WHPahoayDbM ?
for _, onedoer := range d {
go func(od *doer, w *sync.WaitGroup) {
od.do(w)
}(onedoer, &wg)
}
I am wondering if `go func()` could return before figuring out which
function to run, creating a race with the loop.
Thanks in advance!
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/6547c92f-a009-4fd4-abb2-801b2c44ea67n%40googlegroups.com.