3 ms·
This is why I think each instance of a channel should be a global singleton as soon as they escape a local context. IMO you could solve this by having each inst
by packetlost 2y ago
This is why I think each instance of a channel should be a global singleton as soon as they escape a local context. IMO you could solve this by having each instance of a channel be a unique type that must be annotated as that type everywhere it's used. Channels are generic, but you should not generally use them generically.
In Go you can use a type alias to make this work:
type ExitChan <-chan nil
Unfortunately it doesn't really enforce anything at the compiler level, but at the very least you can grep for it.