03-convert-channel-types

command
v0.0.0-...-9882766 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

The purpose of this test is to convert one type of channel to a channel of

open interface, interface{}. Since a chan int, or chan string, or chan inteface{} is it's own chan type, we can't directly do `openInterfaceChannel <- intChannel`, we need to iterate over each item received, and put that value on the new out channel. To figure out what kind of channel we have as input we use the reflect.ValueOf, and use that to set the type of the incomming channel, and then put that value of a new out channel which is of type interface{}.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL