通过不同Go包/文件上的一个通道发送和接收数据

+----------------+                       +-----------------+
| Channel foo    |                       | Channel foo     |
| a.go           |                       | b.go            |
+----------------+                       +-----------------+
       |                                          |
       |__________________________________________|
        Send or receive data through 'foo' channel

Can I create two Go source code files and send or receive data through one channel such as described from image/illustration above? So, these files could communicate each other with sending data while source code is running.

Channels are just variables in Go, like int, []byte or bool. If you can pass any variables between packages, you can obviously then pass channels between packages as well. And once you've passed a channel from one package to another, you are of course free to use it there, just as you would any other variable. That means you can send data in one package, and receive it in another.

Ultimately channels wouldn't be very useful if they couldn't be shared between packages.