On Wed, Sep 1, 2021 at 5:55 PM <sanyia.said...@gmail.com> wrote: > Thanks Bryan, especially for the code example. > > > Would using a sync.WaitGroup in place of the `done` channel in your > example be overkill? Just exploring what’s possible here for my own > education. >
Using a `sync.WaitGroup` in place of the `done` channel would be correct, but perhaps less useful: it's about the same amount of code, but you can `select` on the channel but not on the WaitGroup. (That said, a WaitGroup *would* avoid a pointer indirection: channels are reference types, whereas WaitGroups are value types. That difference is the motivation behind my proposal in https://golang.org/issue/28366.) -- 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/CAKWVi_TPDpinBfzNW8w%3Dd6R-whQPm%3DLhjT%2B_tZCQS0hAY2Nu6w%40mail.gmail.com.