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

Remove vars, pass params explicitly #320

Merged
merged 4 commits into from
Jun 11, 2019
Merged

Remove vars, pass params explicitly #320

merged 4 commits into from
Jun 11, 2019

Conversation

alenkacz
Copy link
Contributor

@alenkacz alenkacz commented Jun 10, 2019

What type of PR is this?
/component kudoctl
/kind cleanup

What this PR does / why we need it:
Prefer explicitly passing parameters instead of global context of variables.

Which issue(s) this PR fixes:

Fixes #290

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

)

func TestInstallCmd(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests were moved to parameters test in the other install_test file

KubeConfigPath string
}

func NewOptions() *Options {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is just creating a struct, I'd just have this be a var..

var *Options DefaultOptions = &Options{
    ...
}

That way it can be inlined by the compiler.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having this as a function is useful when you have other functions you need to call in order to set this struct up.

installCmd.Flags().BoolVar(&options.AutoApprove, "auto-approve", false, "Skip interactive approval when existing version found. (default \"false\")")
installCmd.Flags().StringVar(&options.KubeConfigPath, "kubeconfig", "", "The file path to Kubernetes configuration file. (default \"$HOME/.kube/config\")")
installCmd.Flags().StringVar(&options.InstanceName, "instance", "", "The instance name. (default to Framework name)")
installCmd.Flags().StringVar(&options.Namespace, "namespace", "default", "The namespace used for the framework installation. (default \"default\"")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/framework/package

@alenkacz alenkacz merged commit aaa7faa into master Jun 11, 2019
@alenkacz alenkacz deleted the av/remove-vars branch June 12, 2019 08:32
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

Successfully merging this pull request may close these issues.

Stop using vars in kudoctl
3 participants