add validate subscriber signature func
This commit is contained in:
@@ -534,6 +534,10 @@ func newSubscriber(topic string, sub interface{}, opts ...SubscriberOption) Subs
|
|||||||
h.reqType = typ.In(1)
|
h.reqType = typ.In(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if h.reqType.Kind() == reflect.Interface {
|
||||||
|
panic(fmt.Sprintf("subscriber for %s: request type cannot be interface{} or any", topic))
|
||||||
|
}
|
||||||
|
|
||||||
handlers = append(handlers, h)
|
handlers = append(handlers, h)
|
||||||
} else {
|
} else {
|
||||||
for m := 0; m < typ.NumMethod(); m++ {
|
for m := 0; m < typ.NumMethod(); m++ {
|
||||||
@@ -550,6 +554,10 @@ func newSubscriber(topic string, sub interface{}, opts ...SubscriberOption) Subs
|
|||||||
h.reqType = method.Type.In(2)
|
h.reqType = method.Type.In(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if h.reqType.Kind() == reflect.Interface {
|
||||||
|
panic(fmt.Sprintf("subscriber for %s: request type cannot be interface{} or any", topic))
|
||||||
|
}
|
||||||
|
|
||||||
handlers = append(handlers, h)
|
handlers = append(handlers, h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user