Fun with Channels in Golang



Fun with Channels in Golang

Fun with Channels in Golang

Here, I look at using channels to run a large number of function calls, but only a smaller number at a time in a safe way.
The resulting library should be fairly easy to use in most cases where you want this to happen.

https://github.com/coderconvoy/workers

— Improvement thanks to Devarsh Shah
The main worker functions, can listen in a for–range on res.Main on the channel directly,

This means you no longer need to check if the incoming function is nil.

I’ve updated this on github

Comments are closed.