Generic Watches
for builder
#2955
Labels
lifecycle/stale
Denotes an issue or PR has remained open with no activity and has become stale.
Watches
for builder
#2955
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: