At the moment; Tee and Combine only work in pairs. It is, of course, possible to write TeeN and CombineN, which work on arbitrary slices of channels, using the following signatures.
// TeeN converts a "chan T" into n "chan T", each of which receive exactly the same values,
// possibly in different orders.
func TeeN[T any](ctx context.Context, in <-chan T, n int, opts ...Option) ([]<-chan T)
// CombineN converts a "[]chan T" into a "chan T".
func CombineN[T any](ctx context.Context, ins []<-chan T, opts ...Option) <-chan T
This would be a backwards compatible change which some users may want. Until it has been completed, combining Tee and Combine in pairs is possible as a workaround.
At the moment; Tee and Combine only work in pairs. It is, of course, possible to write
TeeN
andCombineN
, which work on arbitrary slices of channels, using the following signatures.This would be a backwards compatible change which some users may want. Until it has been completed, combining
Tee
andCombine
in pairs is possible as a workaround.