fix the wrong comment (#446)

the original words are :
A channel type may be annotated to specify that it may only send or only receive in certain code:
var send_only chan<- int // channel can only receive data
var recv_only <-chan int // channel can only send data
This commit is contained in:
Neal Caffery
2018-04-06 05:25:59 +08:00
committed by 无闻
parent af797a594f
commit 80b3ba64d2

View File

@@ -525,8 +525,8 @@ for {
通道类型可以用注解来表示它只发送或者只接收: 通道类型可以用注解来表示它只发送或者只接收:
```go ```go
var send_only chan<- int // channel can only send data var send_only chan<- int // channel can only receive data
var recv_only <-chan int // channel can only receive data var recv_only <-chan int // channel can only send data
``` ```
只接收的通道(<-chan T无法关闭因为关闭通道是发送者用来表示不再给通道发送值了所以对只接收通道是没有意义的通道创建的时候都是双向的但也可以分配有方向的通道变量就像以下代码 只接收的通道(<-chan T无法关闭因为关闭通道是发送者用来表示不再给通道发送值了所以对只接收通道是没有意义的通道创建的时候都是双向的但也可以分配有方向的通道变量就像以下代码