Skip to content

Conversation

@yarcat
Copy link
Contributor

@yarcat yarcat commented Sep 9, 2020

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

Footnotes

  1. https://go-proverbs.github.io/

  2. https://golang.org/doc/effective_go.html#channels

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

[^1]: https://go-proverbs.github.io/
[^2]: https://golang.org/doc/effective_go.html#channels
@yarcat yarcat force-pushed the idiomatic-concurrency branch from c7983c0 to ba776bf Compare September 10, 2020 10:08
@yarcat
Copy link
Contributor Author

yarcat commented Sep 10, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant