I'd also tend toward passing in a context to the producer rather than
returning a "kill" channel. That way you get correct cancellation when you
begin to string together multiple producers. I'd recommend reading
https://blog.golang.org/pipelines in any case.
https://play.golang.org/p/ftgqSokde1c
On Tue, Jan 22, 2019 at 8:33 AM wrote:
> Hi, we have the same problem of OP.
> But, in the Chris's playground there could be an error, indeed if the
> consumer
> runs slower of the producer the program ends in a deadlock.
>
> To force this behavior just add a time.Sleep() after the foor loop in m
Hi, we have the same problem of OP.
But, in the Chris's playground there could be an error, indeed if the
consumer
runs slower of the producer the program ends in a deadlock.
To force this behavior just add a time.Sleep() after the foor loop in main.
--> https://play.golang.org/p/A3i6TEyGQm_L
A