Add interface assertion for delegatingByGVKCache
ShyunnY opened this issue · comments
When I was reviewing the source code for delegatingByGVKCache
, I found it difficult to quickly determine which interfaces this type implements. I had to examine the methods and their return values to understand the implemented interfaces. Since delegatingByGVKCache
doesn't have an explicit constructor, we can't infer the implemented interfaces from the return semantics of the constructor.
Therefore, I would like to propose adding interface assertions to the delegatingByGVKCache type, as follows:
var _ Cache = &delegatingByGVKCache{}
var _ client.Reader = &delegatingByGVKCache{}
var _ Informers = &delegatingByGVKCache{}
This feature may not be essential, but it would certainly improve the user experience when reviewing the source code, as it allows for quick identification of the interfaces that the type implements. (At least this can be done without the IDE, and you can quickly learn about its implementation interface.)