Hello,
in a program I’m writing I have (among others) two interface types, which share no common methods.
Let’s call them A and B
type A interface { /* Method set of A */ }
type A interface { /* Method set of B */ }
I now need a type that can hold either one of which.
The first thing that came into my mind is an empty interface, and to then use a type assertion, to determine whether I have A
or B
.
Is there any way to avoid using the empty interface here? I’m kind of reluctant to use it, because I’d loose static checks.