github.com/wfusion/gofusion@v1.1.14/common/utils/channel.go (about) 1 package utils 2 3 func IsChannelClosed[T any](ch <-chan T) (data T, ok bool) { 4 select { 5 case d, opened := <-ch: 6 if !opened { 7 ok = true 8 } 9 data = d 10 return 11 default: 12 return 13 } 14 }