is there any type that cannot be sent on a channel?

67 views
Skip to first unread message

Sathish VJ

unread,
Jun 30, 2019, 12:31:48 PM6/30/19
to golang-nuts
I thought I read somewhere that functions cannot be sent on channels.  But I tried it out and it can be.  Play link: https://play.golang.org/p/OeLpQsNwnCn

So, is there anything that cannot be sent on channels?

Michal Strba

unread,
Jun 30, 2019, 1:03:49 PM6/30/19
to Sathish VJ, golang-nuts
Not sure where you read that. Anything can be sent on a channel. Even channels can be sent over channels. That's often used when one goroutine needs to reply to a message from another goroutine.

ne 30. 6. 2019 o 18:31 Sathish VJ <sath...@gmail.com> napísal(a):
I thought I read somewhere that functions cannot be sent on channels.  But I tried it out and it can be.  Play link: https://play.golang.org/p/OeLpQsNwnCn

So, is there anything that cannot be sent on channels?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/608c41d5-a226-4d77-a8fc-c4563d69f5db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages