Skip to content

Commit

Permalink
Update 14.2.md (#596)
Browse files Browse the repository at this point in the history
Fix a mistake.
  • Loading branch information
perry14 authored and unknwon committed Apr 8, 2019
1 parent 5f078f6 commit d6af03c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion eBook/14.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ var send_only chan<- int // channel can only receive data
var recv_only <-chan int // channel can only send data
```

只接收的通道(<-chan T)无法关闭,因为关闭通道是发送者用来表示不再给通道发送值了,所以对只接收通道是没有意义的。通道创建的时候都是双向的,但也可以分配有方向的通道变量,就像以下代码:
只接收的通道(chan<- T)无法关闭,因为关闭通道是发送者用来表示不再给通道发送值了,所以对只接收通道是没有意义的。通道创建的时候都是双向的,但也可以分配有方向的通道变量,就像以下代码:

```go
var c = make(chan int) // bidirectional
Expand Down

0 comments on commit d6af03c

Please sign in to comment.