I am trying to write a simple code that calls bunch of get requests in 
goroutines and stores result on the struct, that's all -- now I know that 
it is correct with just wg.Wait, ugh.... go would really suck compared to 
javascript if it was not true...
so far not go but godoc manages to trick me:) 
I have also discovered https://github.com/golang/go/issues/5045 - highly 
recommended for everyone who get's to this old post

Dne pondělí 28. srpna 2017 7:49:51 UTC+2 Ian Lance Taylor napsal(a):
>
> On Sat, Aug 26, 2017 at 4:34 AM, honzajde <[email protected] <javascript:>> 
> wrote: 
> > 
> > Back to the primary question: Is it safe to read condition if I add a 
> break 
> > to the loop like this? 
>
> Yes.  sync.WaitGroup.Wait would be useless if it didn't provide a 
> happens-before relationship from changes made in the goroutine that 
> calls Done to the goroutine that calls Wait. 
>
> I suppose this could be documented in the docs for sync.WaitGroup, but 
> it also kind of falls under the "Go is not trying to trick you" rule. 
>
> Ian 
>

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to