golang 如何确定一个channel 关闭 代码实现

答案解析

用for range遍历channel,遍历结束即channel关闭。或接收时判断ok值:v, ok := <-ch,ok为false时说明channel已关闭。