go-imap
go-imap copied to clipboard
Idle example hangs after running
I'm not sure if this behavior is intentional. The Idle example hangs after it has received the first update. I believe the intended behavior is for it to exit. I was able to achieve that by changing this line:
https://github.com/emersion/go-imap/blob/16ffd077a2a8d66fca15b4b63b84a5504d2ccf4c/client/example_test.go#L295
to
updates := make(chan client.Update, 1)
Even if this is intentional, I have a question: I've been coding in Go for a couple years now, but I was surprised that an unserviced channel would result in the program blocking.
After this:
log.Println("Not idling anymore")
return
I would expect it to return and exit. Can someone explain this behavior or point me to a resource for further reading? I tried searching but don't know the right terms.