Go by Example - Channels
Go by Example
Go is an open source programming language designed for building simple, fast, and reliable software.
Go by Example is a hands-on introduction to Go using annotated example programs. Check out the first example or browse the full list below.
Go by Example: Channels
channel是golang中连接不同goroutine之间的管道。你可以从一个goroutine往channel中发送数据而从另一个goroutine中获取到这些数据。
1 | package main |
1 | $ go run channels.go |