channel/utils.go

16 lines
244 B
Go
Raw Permalink Normal View History

2022-02-09 12:10:02 +01:00
package channel
func determineBufferSize[T any](channels []<-chan T) int {
if len(channels) == 0 {
return 0
}
maxBufSize := 0
2022-02-09 12:10:02 +01:00
for _, ch := range channels {
if cap(ch) > maxBufSize {
maxBufSize = cap(ch)
}
2022-02-09 12:10:02 +01:00
}
return maxBufSize
2022-02-09 12:10:02 +01:00
}