On Fri, Aug 4, 2017 at 11:45 AM, Jannick Fahlbusch <jann...@jf-projects.de>
wrote:

> Hi,
>
> you need to spin up another goroutine which ranges over the channel:
> https://play.golang.org/p/OhLd6vOBYE
>
>
>
This has a race condition. There's no guarantee that all the lines will be
printed before main() exits. A better solution is to close the channel so
the range loop exits. I posted an example of that an hour ago:
https://play.golang.org/p/mKdzU1z6Tx

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to