~/Golang Channel Direction Explained
Mar 13, 2020
Golang channels support direction to enforce if a function can only send or receive values. This increases code safety and clarity.
Direction Types
chan T means send and receive permitted.
chan<- T means send only.
<-chan T means receive only.
Example Usage
Passing directional channels prevents misuse. For more, see Golang Tour: Channels and Go Spec.