Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add interface assertion for delegatingByGVKCache #2732

Open
ShyunnY opened this issue Mar 26, 2024 · 0 comments
Open

Add interface assertion for delegatingByGVKCache #2732

ShyunnY opened this issue Mar 26, 2024 · 0 comments

Comments

@ShyunnY
Copy link

ShyunnY commented Mar 26, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant