Go by Example - Channel Directions
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: Channel Directions
当使用管道作为函数参数时,可以显式声明该管道是作为发送者还是接收者,这种特性增加了程序的类型安全。
1 | package main |
1 | $ go run channel-directions.go |