Compiler error reading from channel.

1,210 views
Skip to first unread message

Charles Parker

unread,
Aug 23, 2015, 9:07:31 PM8/23/15
to golang-nuts
I must be doing something wrong. It's my first try with channels, but I don't see it. Appreciate any help.

Compiler output:

==> go run try_it.go

# command-line-arguments

./try_it.go:44: invalid operation: cmd <- cb.providerIn (send to non-chan type int)

./try_it.go:62: invalid operation: inState <- cb.consumerIn (send to non-chan type int)

./try_it.go:66: invalid operation: inData <- cb.data (send to non-chan type interface {})


Thanx - Charlie
try_it.go

andrey mirtchovski

unread,
Aug 23, 2015, 9:57:47 PM8/23/15
to Charles Parker, golang-nuts
instead of:

cmd <-cb.providerIn //**** Line 44

in go you write:

cmd = <-cb.providerIn //**** Line 44

Charles Parker

unread,
Aug 24, 2015, 1:26:35 AM8/24/15
to golang-nuts, j83...@gmail.com
Thanx Andrey,

That was it. I missed the = in all the examples:(

Charlie
Reply all
Reply to author
Forward
0 new messages