In both cases, the channel gets closed before range, as it should be. But
when I retrieve from the closed channel, I get different output from each
case, since the buffered channel is not closed at some point but the
unbuffered channel is closed all the time I check the value. I want to know
when exactly the channel gets closed in buffered case.
It's a bit hard to explain in words. Please run the following playground
and you will see what is making it hard to understand.
I am asking myself some question to understand this code
and can't answer the problem 2 and 3.
Then why the NonBuffered never outputs the TRUE value?
Does this mean the unbuffered channel is always closed?
Then how come the unbuffered channel still produce the right outcome of
Why the NonBuffered output gets cut in the middle like the following?
0 1 1 2 NON_Buffered value: 0
NON_Buffered ok: false
It should be something related with goroutine but Why in this way?
I also tried to look at the source code of close but can't find the
Just one line for close function?
Thanks a lot!
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 firstname.lastname@example.org.
For more options, visit https://groups.google.com/groups/opt_out.