Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

simplify code and turn on more linters #2433

Merged
merged 1 commit into from
Mar 14, 2018

Conversation

jessfraz
Copy link
Contributor

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

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]>
@ghost ghost assigned jessfraz Mar 12, 2018
@ghost ghost added the in progress label Mar 12, 2018
@@ -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 {
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

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

❤️ ❤️

Copy link
Member

@jackfrancis jackfrancis left a comment

Choose a reason for hiding this comment

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

ltgm pending sanity check from @dmitsh or @amanohar on whether actually respecting error from apiloader.LoadContainerServiceFromFile is somehow breaking.

Copy link
Member

@jackfrancis jackfrancis left a comment

Choose a reason for hiding this comment

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

lgtm

@jackfrancis jackfrancis merged commit 4649c8d into Azure:master Mar 14, 2018
@ghost ghost removed the in progress label Mar 14, 2018
@jessfraz jessfraz deleted the delete-code branch March 14, 2018 00:06
tesharp pushed a commit to tesharp/acs-engine that referenced this pull request Mar 16, 2018
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]>
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