You can send any object you like across a channel of the appropriate type. It sends the actual object (in this case, the channel) just as for an integer, it sends the value, or for a map, the whole map.
errChan in the snippet you quote is an ordinary variable, and this is its declaration (like any := case). The type of requestChan is "<-chan chan error", so the thing you read off it is "chan error", which means the type of errChan is a "chan error". (If you read from errChan, you get an "error".) On Mon, Jun 22, 2020 at 3:51 PM joe mcguckin <[email protected]> wrote: > I've been playing with this example code on the playground: > https://play.golang.org/p/4l57Hqw9CLJ > > In func 'goroutine': > > select { > case errChan := <-requestChan: > > How does this work? Does a channel send its name? Is 'errChan' some sort > of special symbol? > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/47d6fc3a-3f94-4661-b111-7c8fecb791d8o%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/47d6fc3a-3f94-4661-b111-7c8fecb791d8o%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2BYjuxsDkr0z1yUOSTLUXa8fN-8b4CD7YbYa7T3ChBMBT6PRqQ%40mail.gmail.com.
