How to check if an object has a particular method?
A simple option is to declare an interface with just the method you want to check for and then do a type assert against your type like; i, ok := myInstance.(InterfaceImplementingThatOneMethodIcareAbout) // inline iface declaration example i, ok = myInstance.(interface{F()}) You likely want to use the reflect package if you plan to do anything too … Read more