gops icon indicating copy to clipboard operation
gops copied to clipboard

More idiomatic Go concurrency

Open yarcat opened this issue 5 years ago • 1 comments

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).

yarcat avatar Sep 09 '20 19:09 yarcat

@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.

yarcat avatar Sep 10 '20 19:09 yarcat