-
Notifications
You must be signed in to change notification settings - Fork 103
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
Conversation
) | ||
|
||
func TestInstallCmd(t *testing.T) { |
There was a problem hiding this comment.
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
pkg/kudoctl/cmd/install/install.go
Outdated
KubeConfigPath string | ||
} | ||
|
||
func NewOptions() *Options { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
pkg/kudoctl/cmd/install.go
Outdated
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\"") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/framework/package
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?: