• Send only: chan<- int
  • Receive only: <-chan int
  • Violation will compile error
  • Only channel used to send msg need to be closed, so to close a receive only channel will compile error
  • A channel can be passed as an unidirectional channel. So that can be foced to use it correctly in function.
  • Can convert a bidirectional channel to unidirectional, but not vice versa


What to read next

Previous / Next
Previous: Go - pipelines Next: Go - buffered channel
More like this
Subscribe via RSS: Macro · Tech

Tags:

Updated: