in internal/kernel/client.go [106:128]
func (c *Client) FindObjectRef(obj reflect.Value) (ref api.ObjectRef, found bool) {
ref = api.ObjectRef{}
found = false
switch obj.Kind() {
case reflect.Struct:
// Structs can be checked only if they are addressable, meaning
// they are obtained from fields of an addressable struct.
if !obj.CanAddr() {
return
}
obj = obj.Addr()
fallthrough
case reflect.Interface, reflect.Ptr:
if ref.InstanceID, found = c.objects.InstanceID(obj); found {
ref.Interfaces = c.objects.Interfaces(ref.InstanceID)
}
return
default:
// Other types cannot possibly be object references!
return
}
}