-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Make pkg/kubectl/cmd/util/factor.go:Factory to be interface #31702
Comments
cc @deads2k |
I think that you could start by creating first class methods for the anonymous ones currently included. |
Also, starting with a single method as an example is probably worthwhile so we can argue over principle there instead of in a larger pull. |
And really it should be multiple interfaces and each command should take the interfaces it requires. That argument is partially why we have deferred this for so long. |
@deads2k , agree :). I'm going to refactor function pointer into functions firstly (one by one); and then refactor For multiple interfaces as @smarterclayton , we can discuss it after those patches. Any comments? |
@k82cn @deads2k @smarterclayton actually we have discussed a lot about kubectl refactor in #7311 #31173, generally we want decouple command framework from command logical, we will try to create logical groups. I agree that we could promote those functions to typed functions, this could be a good start. |
A bunch of the functions already conform to specific kubectl interfaces so it seems that this should end up being an interface composed of other interfaces. Remaining business logic that exists in the Factory should be factored out to interfaces in pkg/kubectl kubernetes/pkg/kubectl/cmd/util/factory.go Lines 690 to 698 in ebe733e
kubernetes/pkg/kubectl/history.go Line 39 in ebe733e
Example that doesn't: kubernetes/pkg/kubectl/cmd/util/factory.go Lines 571 to 629 in ebe733e
|
Refactoring into functions would break valid uses in OpenShift (we On Tue, Aug 30, 2016 at 7:35 PM, Klaus Ma notifications@github.com wrote:
|
@smarterclayton , do you mean OpenShift implements some additional cmd? Try to refactor
BTW, it seems there's no test case in |
I would support this way. |
Hi team, After updating the patch, some unit test are failed; so I'm working to fix it. But any suggestion on how to debug it? I use the following command to
|
Refactor pkg/kubectl/cmd/util/factor.go:Factory to be a interface. Currently, the
util.Factory
is defined by function pointer:In Go, it's better to make Factory to be an struct; it'll also reduce the code line of
NewFactory()
which is more than 100 line of code :).cc @adohe / @pwittrock
The text was updated successfully, but these errors were encountered: