2 ms·
It's not great, but I use this pattern to check / enforce interface membership. type Bar interface { BarMethod(int, int) int } type Foo struct {}
by BreakfastB0b 4y ago
It's not great, but I use this pattern to check / enforce interface membership.
type Bar interface {
BarMethod(int, int) int
}
type Foo struct {}
// Error: Foo does not implement Bar (missing method BarMethod)
var _fooImplementsBar Bar = Foo{}