add validate subscriber signature func
Some checks failed
test / test (pull_request) Failing after 18m22s
lint / lint (pull_request) Failing after 18m35s
coverage / build (pull_request) Failing after 18m42s

This commit is contained in:
Evstigneev Denis
2026-01-15 11:50:43 +03:00
parent b4433c42f0
commit 43f77bed23

View File

@@ -534,6 +534,10 @@ func newSubscriber(topic string, sub interface{}, opts ...SubscriberOption) Subs
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)
} else {
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)
}
if h.reqType.Kind() == reflect.Interface {
panic(fmt.Sprintf("subscriber for %s: request type cannot be interface{} or any", topic))
}
handlers = append(handlers, h)
}
}