From d21dedf4b9339ab21b37a4c2711c743be8005ccd Mon Sep 17 00:00:00 2001 From: Josh Leverette Date: Wed, 9 Jun 2021 19:30:44 -0400 Subject: [PATCH] Also mention another restriction of receive-only channels --- examples/channel-directions/channel-directions.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/channel-directions/channel-directions.go b/examples/channel-directions/channel-directions.go index 5f2786c..0bbd411 100644 --- a/examples/channel-directions/channel-directions.go +++ b/examples/channel-directions/channel-directions.go @@ -19,6 +19,10 @@ func ping(pings chan<- string, msg string) { func pong(pings <-chan string, pongs chan<- string) { msg := <-pings pongs <- msg + + // it is a compile-time error to close + // the receive-only channel `pings`. + // close(pings) } func main() {