go-imap
go-imap copied to clipboard
Allow using context.Context instead of a channel
It would be great to have the possibility to use a context instead of a channel in function calls, since they pretty much do exactly what the stop channel is supposed to do as well. With network libraries it's more common to use a context which also allows for easy implementation of timeouts and cancellation that's passed through multiple child contexts.
- breaking the API can be avoided by adding a
*Ctx
function which just acceptscontext.Context
instead of a stop channel - code duplication can be avoided by just calling the
*Ctx
-function from the channel-function