Skip to content
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

issue-544, refactor externalChanges message #634

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

OleksiienkoMykyta
Copy link
Collaborator

No description provided.

}

if len(ignoreFields) == 0 {
return string(k8sSpecJson), nil
Copy link
Contributor

@ribaraka ribaraka Dec 1, 2023

Choose a reason for hiding this comment

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

You can just return bytes in this func

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@@ -158,8 +158,36 @@ func getSortedAppVersions(versions []*models.AppVersions, appType string) []*ver
return nil
}

func removeRedundantFieldsFromSpec(k8sSpec interface{}, ignoreFields ...string) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we use any as for interface{}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

}

k8sSpecMap := map[string]interface{}{}
err = json.Unmarshal([]byte(string(k8sSpecJson)), &k8sSpecMap)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
err = json.Unmarshal([]byte(string(k8sSpecJson)), &k8sSpecMap)
err = json.Unmarshal(k8sSpecJson, &k8sSpecMap)

try this. less conversions and it looks cleaner.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

return string(k8sSpecJson), nil
}

k8sSpecMap := map[string]interface{}{}
Copy link
Contributor

Choose a reason for hiding this comment

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

any over interfaces

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@OleksiienkoMykyta OleksiienkoMykyta force-pushed the issue-544-refactor-externalChanges-message branch from fe82e0b to 5bf22c0 Compare December 5, 2023 14:04
@OleksiienkoMykyta OleksiienkoMykyta force-pushed the issue-544-refactor-externalChanges-message branch from 5bf22c0 to 93e0294 Compare December 5, 2023 14:06
@testisnullus testisnullus merged commit 8dd9a0e into main Dec 6, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants