[go-nuts] Is there any way to define a struct member to hold a generic type channel?

2018-03-23 Thread matthewjuran
An empty interface var can hold any type, so you could have a chan interface{} then use an interface type assertion when you read a value. Matt -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

[go-nuts] Is there any way to define a struct member to hold a generic type channel?

2018-03-23 Thread liuyain
I'm trying to define a Reference Counted Channel struct, like below: type RefCountedChannel { Channel chan Type RefCount int mux sync.Mutex } I have to define different struts to hold different channel types. But I don't care the type of Channel, I just close is when RefCount become