workers: get to executing tasks remotely!
This commit is contained in:
+10
-1
@@ -138,8 +138,17 @@ func as(in interface{}, as interface{}) interface{} {
|
||||
|
||||
return reflect.MakeFunc(ctype, func(args []reflect.Value) (results []reflect.Value) {
|
||||
outs := reflect.ValueOf(in).Call(args)
|
||||
|
||||
out := reflect.New(outType.Elem())
|
||||
out.Elem().Set(outs[0])
|
||||
if outs[0].Type().AssignableTo(outType.Elem()) {
|
||||
// Out: Iface = In: *Struct; Out: Iface = In: OtherIface
|
||||
out.Elem().Set(outs[0])
|
||||
} else {
|
||||
// Out: Iface = &(In: Struct)
|
||||
t := reflect.New(outs[0].Type())
|
||||
t.Elem().Set(outs[0])
|
||||
out.Elem().Set(t)
|
||||
}
|
||||
outs[0] = out.Elem()
|
||||
|
||||
return outs
|
||||
|
||||
Reference in New Issue
Block a user