▲ | Cyph0n a day ago | |||||||
But if you’re looking at the package API, there is no alternative constructor for Group, which makes it seem as if the most common default is to construct a Group using WithContext. Also, 2/3 of the examples use WithContext. My recommendation would be to have a NewGroup function or equivalent that returns an empty group to surface it as an alternative to WithContext. | ||||||||
▲ | evanelias a day ago | parent [-] | |||||||
> My recommendation would be to have a NewGroup function or equivalent that returns an empty group That goes against common practices in Golang, articulated in the second paragraph of https://go.dev/doc/effective_go#allocation_new among many other places. Also the errgroup documentation specifically says "A zero Group is valid, has no limit on the number of active goroutines, and does not cancel on error." And, as you noted, one of the examples doesn't use WithContext. | ||||||||
|