-
Notifications
You must be signed in to change notification settings - Fork 558
simplify code and turn on more linters #2433
Conversation
Things that were simplified: - a lot of returns can be simplified to return the error early - checking of bools can be done with a bang (!) instead of == false, etc - remove some dead code Signed-off-by: Jess Frazelle <[email protected]>
@@ -353,12 +352,15 @@ func (sc *scaleCmd) run(cmd *cobra.Command, args []string) error { | |||
} | |||
var apiVersion string | |||
sc.containerService, apiVersion, err = apiloader.LoadContainerServiceFromFile(sc.apiModelPath, false, true, nil) | |||
if err != nil { |
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.
So actually doing something with this err
makes perfect sense. @amanohar @dmitsh could you take a look at this code and make sure that there isn't a reason why we actually want to absorb this error no matter what? (in which case we should throw away the err
reference and replace with _
).
I mean, we definitely want to not ignore errors, but if doing so in this scale code actually breaks something holistically, we want to know about it so that we can fix the entire stack.
@@ -824,7 +824,7 @@ func assignDefaultAddonVals(addon, defaults api.KubernetesAddon) api.KubernetesA | |||
} | |||
for key, val := range defaults.Config { | |||
if addon.Config == nil { | |||
addon.Config = make(map[string]string, 0) | |||
addon.Config = make(map[string]string) |
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.
❤️
@@ -854,8 +854,7 @@ func addDefaultFeatureGates(m map[string]string, version string, minVersion stri | |||
} | |||
|
|||
func combineValues(inputs ...string) string { | |||
var valueMap map[string]string | |||
valueMap = make(map[string]string) | |||
valueMap := make(map[string]string) |
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.
❤️ ❤️
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.
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.
lgtm
Things that were simplified: - a lot of returns can be simplified to return the error early - checking of bools can be done with a bang (!) instead of == false, etc - remove some dead code Signed-off-by: Jess Frazelle <[email protected]>
Things that were simplified: