On Monday, October 14, 2019 at 5:53:23 AM UTC-7, Jeff Kayser wrote:
>
> I'm working through the most excellent book "Concurrency in Go", doing the 
> example on page 162-166.  My code is here:
>
> https://play.golang.org/p/7kokkAIdhov
>
> The program is not triggering the timeout section of the code (lines 
> 103-103 in the playground code).
>
> All of the other examples have worked as expected, including the one just 
> before this, which is almost identical, except for a couple of tweaks.  
> This is the first one that hasn't worked.
>
> What am I doing wrong?
>
> ~Jeff Kayser
>
>
Forgot to increment the variable "i" (the loop counter).  Doh!  My bad.  I 
found it.  Thanks for looking over my buggy code.
After I fixed that, I also discovered that, by ending the loop after two 
iterations, the goroutine ended, closed the channels, and then the main 
program detected the channel closing, rather than the timeout.  Lovely.  
As Benny Hill would say: "Learning all the time".

The book "Concurrency in Go" is absolutely fabulous, second only to The Go 
Programming Language.
We are so lucky to have all those good Go books.

Thanks again.

Jeff Kayser

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/683804bf-b6de-4ebe-a559-f167d17391e5%40googlegroups.com.

Reply via email to