Documentation:
The optional <- operator specifies the channel direction, send or receive. If no direction is given, the channel is bidirectional. A channel may be constrained only to send or only to receive by assignment or explicit conversion.
chan T // can be used to send and receive values of type T
chan<- float64 // can only be used to send float64s
<-chan int // can only be used to receive ints
The <- operator associates with the leftmost chan possible:
chan<- chan int // same as chan<- (chan int)
chan<- <-chan int // same as chan<- (<-chan int)
<-chan <-chan int // same as <-chan (<-chan int)
chan (<-chan int)
The <- operator associates with the leftmost chan possible (Documentation)
Why are we using c <- <- input1 for receiving? c is sending c <- and receiving <-input1?
chan<- (<-chan int) or c <- (<- input1) is the equivalent, but when i read this from left to right out loud it does not make sense. c is sending c <- and receiving <-input1? Do the <- <- cancel each other and default to the left most channel receiving?
I understand the cis a bidirectional channel so that it handles conversion for both receiving and sending, but for some reason I am having a hard time seeing the logical pattern here.