You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#2214 introduced (through #2783) generic funcs for Event, Predicate and Handler.
TypedBuilder has only 1 type parameter for the request type and since Go (as of 1.23) doesn't allow type parameters on methods golang/go#49085, Watches() uses handler.TypedEventHandler[client.Object, request] as eventHandler parameter.
That client.Object limits the handler functions to only have client.Object as argument types so users have to use:
cannot use handler.TypedEnqueueRequestsFromMapFunc(podForServiceTyped) (value of type handler.TypedEventHandler[*"k8s.io/api/core/v1".Service, reconcile.Request]) as handler.TypedEventHandler[client.Object, reconcile.Request] value in argument to b.Watches: handler.TypedEventHandler[*"k8s.io/api/core/v1".Service, reconcile.Request] does not implement handler.TypedEventHandler[client.Object, reconcile.Request] (wrong type for method Create)
have Create(context.Context, event.TypedCreateEvent[*"k8s.io/api/core/v1".Service], workqueue.TypedRateLimitingInterface[reconcile.Request])
want Create(context.Context, event.TypedCreateEvent[client.Object], workqueue.TypedRateLimitingInterface[reconcile.Request])
Additional information
Due to golang/go#49085 this cannot be (easily?at all?) implemented as noted in #2783.
This issue is mostly for tracking and to acknowledge the API limitation.
Feel free to comment on the issue if you feel there's a way to move forward without Go implementing golang/go#49085.
Current workaround
If I understand correctly, the following is an equivalent which can be used:
Problem statement
#2214 introduced (through #2783) generic funcs for
Event
,Predicate
andHandler
.TypedBuilder
has only 1 type parameter for the request type and since Go (as of 1.23) doesn't allow type parameters on methods golang/go#49085,Watches()
useshandler.TypedEventHandler[client.Object, request]
aseventHandler
parameter.That
client.Object
limits the handler functions to only haveclient.Object
as argument types so users have to use:and cannot use strongly typed handlers like
because
Additional information
Due to golang/go#49085 this cannot be (easily?at all?) implemented as noted in #2783.
This issue is mostly for tracking and to acknowledge the API limitation.
Feel free to comment on the issue if you feel there's a way to move forward without Go implementing golang/go#49085.
Current workaround
If I understand correctly, the following is an equivalent which can be used:
The text was updated successfully, but these errors were encountered: