package ioc import "reflect" // InterfaceOf dereferences a pointer to an Interface type. // It panics if value is not a pointer to an interface. func InterfaceOf(value interface{}) reflect.Type { t := reflect.TypeOf(value) for t.Kind() == reflect.Ptr { t = t.Elem() } if t.Kind() != reflect.Interface { panic("the value is not a pointer to an interface. (*MyInterface)(nil)") } return t }