logoalt Hacker News

nasretdinovtoday at 8:42 PM3 repliesview on HN

Also having stuff like a concurrency limiter (instead of doing weird var limiter chan struct{} and using it as `limiter <- struct{}{}` and `defer <-limiter`) as a library function in `sync` package would be great too.


Replies

astonextoday at 10:26 PM

There is actually a way to do this with errgroup provided you can work with func() error signature

https://pkg.go.dev/golang.org/x/sync/errgroup#Group.SetLimit

show 1 reply
aatd86today at 9:00 PM

But I guess the issue is that oftentimes, it is more of a distributed system coordination issue?

What use case do you have in mind?