Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

cli/cmd: cleanups part 2 #1015

Merged
merged 15 commits into from
Oct 16, 2020
Merged

cli/cmd: cleanups part 2 #1015

merged 15 commits into from
Oct 16, 2020

Conversation

invidian
Copy link
Member

@invidian invidian commented Sep 25, 2020

Includes commits from #1013

Part of #603.

@invidian invidian force-pushed the invidian/cli-cleanup-part2 branch 2 times, most recently from 6efb011 to 9e346e0 Compare September 25, 2020 12:20
@invidian invidian force-pushed the invidian/cli-cleanup-part2 branch 2 times, most recently from c02067c to 1e1b630 Compare October 8, 2020 09:53
Copy link
Member

@knrt10 knrt10 left a comment

Choose a reason for hiding this comment

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

Overall looks good to me. Nice work

knrt10
knrt10 previously approved these changes Oct 14, 2020
cli/cmd/component-apply.go Show resolved Hide resolved
@@ -23,6 +23,7 @@ import (

"github.com/kinvolk/lokomotive/pkg/components"
"github.com/kinvolk/lokomotive/pkg/components/util"
"github.com/kinvolk/lokomotive/pkg/config"
Copy link
Member

Choose a reason for hiding this comment

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

I think all the component delete code can be coalesced into one commit. It is very confusing to read some change here and some change there. I think it makes sense to add them all to one commit and then list all the changes that have happened.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you want to review changes aggregated, you can use git diff with range or "Changed files" tab in GitHub UI. I wouldn't lose the information of those changes, as each of them is a small independent step making things a bit better.

Also, having more commits makes bisecting easier in case of bugs, which definitely might be introduced by those changes.

cli/cmd/component-delete.go Outdated Show resolved Hide resolved
cli/cmd/component-delete.go Show resolved Hide resolved
Copy link
Member

@surajssd surajssd left a comment

Choose a reason for hiding this comment

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

Code is ok, please change the name of func to make it more understandable what it is doing.

To remove a dependency on log.Entry to make moving this code around
easier and to avoid hiding function complexity from logger.

Part of #630

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
To remove a dependency on log.Entry to make moving this code around
easier and to avoid hiding function complexity from logger.

Also, it no longer requires logger, so argument has been removed.

Part of #630

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
To remove a dependency on log.Entry to make moving this code around
easier and to avoid hiding function complexity from logger.

Also, it no longer requires logger, so argument has been removed.

Part of #630

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
To remove a dependency on log.Entry to make moving this code around
easier and to avoid hiding function complexity from logger.

Part of #630

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
To soften the dependency on log.Entry and to separate it strictly
from *cobra.Command, so it is easier to move this code around in the
future.

Part of #630

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
So they are easier to trace if something fails, which makes debugging
easier.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
To make tracing and debugging easier.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
So it can be moved to function which can be shared with component
apply code.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
By moving confirmation message declaration from function call into a
variable.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
So code can be re-used in component apply function.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
To de-duplicate logic of selecting components to operate on.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
As it does not add any value, as we create a slice of objects anyway
instead of specifying them by hand.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
As it does not add any value, as we create a slice of objects anyway
instead of specifying them by hand.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Instead of slice of names. This shifts the error handling of getting
components to earlier stage, so we don't apply one component and then
fail, because other one does not exist.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
To make distinction between this function and componentApply() more
clear.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Copy link
Member

@surajssd surajssd left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants