Skip to content

[UPDATE] Add pre-commit hooks to catch linting issues #2098

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

Merged
merged 3 commits into from
Apr 26, 2023

Conversation

Devils-Knight
Copy link
Contributor

@varunsh-coder please review the changes.

}

alreadyPresentHooks := make(map[string]bool)
for _, repos := range configMetadata.Repos {
Copy link
Member

Choose a reason for hiding this comment

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

When I run the test case locally, it fails off and on. This is because the order of repos in the output changes in a non-deterministic manner. range may return different order.

https://stackoverflow.com/questions/13744996/why-does-gos-map-iteration-order-vary-when-printing

https://stackoverflow.com/questions/18342784/how-to-iterate-through-a-map-in-golang-in-order

@Devils-Knight you will need to fix this in all places where range is used, and which may affect the order in the output file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the sorting code for repos returned so that the order of hooks retrieval is not affected by map iteration.
@varunsh-coder please review the fix, thank you.

@varunsh-coder varunsh-coder merged commit 6ecd88d into step-security:int Apr 26, 2023
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.

2 participants