gops
gops copied to clipboard
More idiomatic Go concurrency
Back to using semaphores removed by #126.
This solution is a bit more idiomatic and resonates with "Don't communicate by sharing memory, share memory by communicating." Go proverb ^1.
Similar approach to use buffered channel as a semaphore to limit throughput is discussed in Effective Go ^2.
In addition to that it's almost twice less code (see those +19 and -35 lines).
@tklauser @rakyll Could you please take a look? This change doesn't really modify any functionality -- it's a pure stylistic cleanup. And now, as we have tests, I feel very confident about not breaking anything w/ it.