Following the init phases work in 1.13, we are left with a couple of functions in init.go, that take an awful lot of parameters, but should only take a single struct pointer and use that.
AddInitOtherFlags:func AddInitOtherFlags(
flagSet *flag.FlagSet,
cfgPath *string,
skipTokenPrint, dryRun, uploadCerts *bool,
ignorePreflightErrors *[]string,
) {
AddInitOtherFlags(cmd.Flags(), &initOptions.cfgPath, &initOptions.skipTokenPrint, &initOptions.dryRun, &initOptions.uploadCerts, &initOptions.ignorePreflightErrors)
func AddInitOtherFlags(flagSet *flag.FlagSet, initOptions *initOptions)
AddInitOtherFlags(cmd.Flags(), initOptions)
printJoinCommand:func printJoinCommand(out io.Writer, adminKubeConfigPath, token, key string, skipTokenPrint, uploadCerts bool) error
printJoinCommand(out, adminKubeConfigPath, token, i.certificateKey, i.skipTokenPrint, i.uploadCerts)
func printJoinCommand(out io.Writer, adminKubeConfigPath, token string, i *initData) error
printJoinCommand(out, adminKubeConfigPath, token, i)
In both cases the structs are already put in place. What needs to be done is a simple refactor, that replaces the parameters in those structs with the structs themselves (as shown in the examples above).
Don't hesitate to ping me, I'll be happy to give you guidance and reviews.
/kind cleanup
/priority important-longterm
/good-first-issue
@rosti:
This request has been marked as suitable for new contributors.
Please ensure the request meets the requirements listed here.
If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue command.
In response to this:
Following the init phases work in 1.13, we are left with a couple of functions in
init.go, that take an awful lot of parameters, but should only take a single struct pointer and use that.
AddInitOtherFlags:- Definition from latest master:
func AddInitOtherFlags( flagSet *flag.FlagSet, cfgPath *string, skipTokenPrint, dryRun, uploadCerts *bool, ignorePreflightErrors *[]string, ) {
- The only invocation:
AddInitOtherFlags(cmd.Flags(), &initOptions.cfgPath, &initOptions.skipTokenPrint, &initOptions.dryRun, &initOptions.uploadCerts, &initOptions.ignorePreflightErrors)
- New definition:
func AddInitOtherFlags(flagSet *flag.FlagSet, initOptions *initOptions)
- How it should be invoked:
AddInitOtherFlags(cmd.Flags(), initOptions)
printJoinCommand:- Definition from latest master:
func printJoinCommand(out io.Writer, adminKubeConfigPath, token, key string, skipTokenPrint, uploadCerts bool) error
- The only invocation:
printJoinCommand(out, adminKubeConfigPath, token, i.certificateKey, i.skipTokenPrint, i.uploadCerts)
- New definition:
func printJoinCommand(out io.Writer, adminKubeConfigPath, token string, i *initData) error
- How it should be invoked:
printJoinCommand(out, adminKubeConfigPath, token, i)In both cases the structs are already put in place. What needs to be done is a simple refactor, that replaces the parameters in those structs with the structs themselves (as shown in the examples above).
Don't hesitate to ping me, I'll be happy to give you guidance and reviews.
/kind cleanup
/priority important-longterm
/good-first-issue
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
@rosti I wants to take it if no one works on it.
/lifecycle active
thanks @pytimer
Thanks @rosti
I'm pretty sure that changes similar to what you suggested could be applied to join as well (but in a separated PR)
Most helpful comment
Thanks @rosti
I'm pretty sure that changes similar to what you suggested could be applied to join as well (but in a separated PR)