Go不会阻止您在goroutine /线程之间共享内存。它们的含义是,您通过通道发送数据块或指向该数据块的指针。这有效地将数据的“所有权”转移到通道的目标读取器。请注意,所有权的转移不是由语言或运行时强制执行的,只是按照惯例。如果您愿意的话,您仍然可以从两个goroutine写入同一内存。换句话说:Go并不能阻止您用脚射击自己,它只是提供了使这些错误更易于发现的语言语义。如果将值传递给通道,则程序员必须假定该值不再是他在同一goroutine中要写入的值。func F(c chan *T) { // Create/load some data. data := getSomeData() // Send data into the channel. c <- data // 'data' should now be considered out-of-bounds for the remainder of // this function. This is purely by convention, and is not enforced // anywhere. For example, the following is still valid Go code, but will // lead to problems. data.Field = 123}