goroutine在创建通道时如何表现[关闭]

Suppose I have a function which creates a goroutine and inside that goroutine, I create a channel. My question is that when we create N go routines, N separate channels will be created?

A sample code here:

func createAChannel() {

  // make a channel

}
func main() {
  for i := 0; i < 10; i++ {
  go createAChannel()}

}

Yes, every time you create a channel with make, you get a new channel.

If you want multiple goroutines to share a channel instead, you have to create the channel in the parent goroutine and pass it to the child goroutines.