咨询一个问题,go语言实战上面的例子,先关闭channel,然后range,这可行么?谢谢
// Close the channel before we drain the channel of its
// resources. If we don't do this, we will have a deadlock.
close(p.resources)
// Close the resources
for r := range p.resources {
r.Close()
}
有疑问加站长微信联系(非本文作者)