Here’s a helper... https://github.com/korovkin/limiter/blob/master/README.md
You can do it using several other mechanisms as well. On Fri, Jun 7, 2019 at 6:31 PM Joseph Wang <wzfbr...@gmail.com> wrote: > I mean at same time only 4 go routines run and then creat another 4 etc. > > On Fri, Jun 7, 2019 at 6:27 PM Joseph Wang <wzfbr...@gmail.com> wrote: > >> Hi everyone >> >> I have a simple question about go routines. >> >> So I have a function like this >> >> Func1() { >> >> for n := range array { >> go fun2() >> } >> } >> >> So as I can not make sure array has a fix size, then I cannot control go >> routines number. Does any one have some elegant ways that I can limit this >> function1 create fix number go routines? >> >> Best >> >> Joseph >> > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CABp8xEnDcrNHhFO-DPrOOmXAy%2B%3DA04QVcgA%2B5E2DABn-B6dCpQ%40mail.gmail.com > <https://groups.google.com/d/msgid/golang-nuts/CABp8xEnDcrNHhFO-DPrOOmXAy%2B%3DA04QVcgA%2B5E2DABn-B6dCpQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- *Michael T. jonesmichael.jo...@gmail.com <michael.jo...@gmail.com>* -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CALoEmQywoNLe74s3s8qGBiACW4YJD-fq-maZZGutNUvjFH88GQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.