I have a constructor that returns an interface. There are cases when that interface does not have actual implementation of some of its functions. Trying to call these unemplemented functions causes panic. I want to know is there a way to check is it safe to call a function or not, before actually calling it.
Here is the setup.
package main
type i interface {
Foo()
Bar()
}
type s struct {
i
}
func (r s) Foo() {}
func main() {
var ii i = &s{}
ii.Foo() // OK
ii.Bar() // will panic
}