Merge pull request 'add validate subscriber signature func' (#411) from devstigneev/micro:v3_validate_subs into v3
Some checks failed
test / test (push) Failing after 16m58s
coverage / build (push) Failing after 17m14s

Reviewed-on: #411
This commit was merged in pull request #411.
This commit is contained in:
2026-01-30 23:28:54 +03:00

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)
}
}