Re: [go-nuts] Re: About a channel detail, bug, defect, or intended?

2018-04-07 Thread T L
On Saturday, April 7, 2018 at 9:04:38 AM UTC-4, T L wrote: > > > > On Saturday, April 7, 2018 at 8:39:22 AM UTC-4, Steven Hartland wrote: >> >> You should use a wait group to guarantee the behaviour of this. >> > > I know there are other ways to do the task. > I just feel the runtime behavior is

Re: [go-nuts] Re: About a channel detail, bug, defect, or intended?

2018-04-07 Thread T L
On Saturday, April 7, 2018 at 8:39:22 AM UTC-4, Steven Hartland wrote: > > You should use a wait group to guarantee the behaviour of this. > I know there are other ways to do the task. I just feel the runtime behavior is some strange. The following is the code to receive a value if there are so

Re: [go-nuts] Re: About a channel detail, bug, defect, or intended?

2018-04-07 Thread Steven Hartland
You should use a wait group to guarantee the behaviour of this. On Sat, 7 Apr 2018 at 12:54, T L wrote: > > > On Monday, March 26, 2018 at 4:09:24 PM UTC-4, Marvin Renich wrote: >> >> It seems that you understand why you are seeing the behavior you >> reported, but you are questioning whether th

Re: [go-nuts] Re: About a channel detail, bug, defect, or intended?

2018-04-07 Thread T L
On Monday, March 26, 2018 at 4:09:24 PM UTC-4, Marvin Renich wrote: > > It seems that you understand why you are seeing the behavior you > reported, but you are questioning whether the spec either does or should > guarantee that reading from a channel with a goroutine waiting to send > on that

Re: [go-nuts] Re: About a channel detail, bug, defect, or intended?

2018-03-26 Thread Marvin Renich
It seems that you understand why you are seeing the behavior you reported, but you are questioning whether the spec either does or should guarantee that reading from a channel with a goroutine waiting to send on that channel will fill the buffer as an atomic part of the read. As others have said,

[go-nuts] Re: About a channel detail, bug, defect, or intended?

2018-03-25 Thread Krzysztof Kowalczyk
The way to guarantee that you wait until goroutines are finished is by using sync.WaitGroup. See https://www.programming-books.io/essential/go/139-wait-for-goroutines-to-finish for example and longer description. Alternatively, use range over a channel and arrange the code so that you close t

[go-nuts] Re: About a channel detail, bug, defect, or intended?

2018-03-24 Thread T L
On Saturday, March 24, 2018 at 11:49:11 AM UTC-4, Jake Montgomery wrote: > > There may not be any guarantee that the channel will always be full, but > in practice your code always produces 100 results for me. Both in the > playground , and on my machine

[go-nuts] Re: About a channel detail, bug, defect, or intended?

2018-03-24 Thread jake6502
There may not be any guarantee that the channel will always be full, but in practice your code always produces 100 results for me. Both in the playground , and on my machine (go version go1.10 windows/amd64). With or without the Sleep commented out. Am I