事实上Golang中的单向channel只是一种声明,主要是为了防止channel被滥用。使用普通的channel也能完成任务,但是使用单向channel后如果出现滥用,在编译期间会报错,这样可以有效的提示开发者。

When using channels as function parameters, you can specify if a channel is meant to only send or receive values. This specificity increases the type-safety of the program.

Golang的示例说明里面也表明这个主要是为了提高程序的类型安全。