Hi,
you need to spin up another goroutine which ranges over the channel:
https://play.golang.org/p/OhLd6vOBYE
The reason for the deadlock is: You spin up N workers which are sending
the results over the "fact_chan"-Channel. After you did this, you are
listening on the main-routine for messages on fact_chan forever. But
after all of the workers finished their tasks, there is nobody to send
data. The runtime detects this and panics.
- Jannick
Am 04.08.2017 um 17:11 schrieb
prank...@gmail.com:
> *Factorial Program in GoLang. Encountering deadlock.*
> *
> *
> *Hello All,*
> *
> *
> --
> 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...@googlegroups.com
> <mailto:
golang-nuts...@googlegroups.com>.
> For more options, visit
https://groups.google.com/d/optout.