diff --git a/cmd/version/cmd.go b/cmd/version/cmd.go index 9dc34424cf..4da99cbe46 100644 --- a/cmd/version/cmd.go +++ b/cmd/version/cmd.go @@ -58,7 +58,7 @@ func NewRosaVersionCommand() *cobra.Command { return cmd } -func RosaVersionRunner(userOptions RosaVersionUserOptions) rosa.CommandRunner { +func RosaVersionRunner(userOptions *RosaVersionUserOptions) rosa.CommandRunner { return func(_ context.Context, _ *rosa.Runtime, _ *cobra.Command, _ []string) error { options, err := NewRosaVersionOptions() if err != nil { diff --git a/cmd/version/cmd_test.go b/cmd/version/cmd_test.go index d4a88ce195..15f3af7e48 100644 --- a/cmd/version/cmd_test.go +++ b/cmd/version/cmd_test.go @@ -46,7 +46,7 @@ var _ = Describe("RosaVersionOptions", func() { verifyRosa: mockVerify, reporter: rpt, - args: RosaVersionUserOptions{ + args: &RosaVersionUserOptions{ clientOnly: false, }, } @@ -87,7 +87,7 @@ var _ = Describe("RosaVersionOptions", func() { verifyRosa: mockVerify, reporter: rpt, - args: RosaVersionUserOptions{ + args: &RosaVersionUserOptions{ clientOnly: true, }, } @@ -114,7 +114,7 @@ var _ = Describe("RosaVersionOptions", func() { verifyRosa: mockVerify, reporter: rpt, - args: RosaVersionUserOptions{ + args: &RosaVersionUserOptions{ clientOnly: true, verbose: true, }, diff --git a/cmd/version/options.go b/cmd/version/options.go index 7b53bbff93..98ae02d9e9 100644 --- a/cmd/version/options.go +++ b/cmd/version/options.go @@ -14,15 +14,15 @@ type RosaVersionUserOptions struct { verbose bool } -func NewRosaVersionUserOptions() RosaVersionUserOptions { - return RosaVersionUserOptions{} +func NewRosaVersionUserOptions() *RosaVersionUserOptions { + return &RosaVersionUserOptions{} } type RosaVersionOptions struct { reporter *reporter.Object verifyRosa verify.VerifyRosa - args RosaVersionUserOptions + args *RosaVersionUserOptions } func NewRosaVersionOptions() (*RosaVersionOptions, error) { @@ -55,7 +55,6 @@ func (o *RosaVersionOptions) Version() error { return nil } -func (o *RosaVersionOptions) BindAndValidate(options RosaVersionUserOptions) { - o.args.verbose = options.verbose - o.args.clientOnly = options.clientOnly +func (o *RosaVersionOptions) BindAndValidate(options *RosaVersionUserOptions) { + o.args = options } diff --git a/cmd/version/options_test.go b/cmd/version/options_test.go index c9fc29b346..ba85a21369 100644 --- a/cmd/version/options_test.go +++ b/cmd/version/options_test.go @@ -24,16 +24,16 @@ var _ = Describe("RosaVersionOptions", func() { verbose: true, clientOnly: true, } - o.BindAndValidate(userOptions) - Expect(o.args).To(Equal(expectedArgs)) + o.BindAndValidate(&userOptions) + Expect(o.args).To(Equal(&expectedArgs)) }) }) When("empty options are provided", func() { It("should not change the default options", func() { o = &RosaVersionOptions{} - o.BindAndValidate(RosaVersionUserOptions{}) - Expect(o.args).To(Equal(RosaVersionUserOptions{})) + o.BindAndValidate(&RosaVersionUserOptions{}) + Expect(o.args).To(Equal(&RosaVersionUserOptions{})) }) }) })