vladimirvivien / learning-go

Source code repository for my book "Learning Go Programming"
https://www.packtpub.com/application-development/learning-go-programming
BSD 2-Clause "Simplified" License
232 stars 84 forks source link

learning-go/ch09/goroutine5.go #1

Open TimLeary opened 7 years ago

TimLeary commented 7 years ago

sometime it runs "panic: close of closed channel" on "close(stopCh)"

how we can miss this error?

vladimirvivien commented 7 years ago

@TimLeary thank you for pointing this out. I will take a look.

vladimirvivien commented 7 years ago

@TimLeary I just reviewed that example, it is not using channels at all.

https://github.com/vladimirvivien/learning-go/blob/master/ch09/goroutine5.go

Are you sure ch09/goroutine5.go is the right sample code you had issue with? If so, please re-open.

TimLeary commented 7 years ago

Sorry, I mixed it up. The problem is in https://github.com/vladimirvivien/learning-go/blob/master/ch09/pattern5.go It does not go wrong not all time, but sometimes.

vladimirvivien commented 7 years ago

@TimLeary I reopened the issue. If you can get it to panic, please paste panic message here. Meanwhile I will try to replicate as well.