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

replace math/rand with the rand pkg from k8s.io/apimachinery #52

Closed
wants to merge 1 commit into from

Conversation

tariq1890
Copy link
Contributor

@tariq1890 tariq1890 commented Apr 11, 2024

Fixes the gosec G404 linting issues
Removed the need to add exclude directives to the golangci-lint config file

Copy link
Member

@elezar elezar left a comment

Choose a reason for hiding this comment

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

As was the case with the changes for NVIDIA/k8s-device-plugin#629 I don't think these are required. These are in tests and we KNOW that the use of math/rand will not cause issues in this case.

Although the use of k8s.io/apimachinery/pkg/util/rand addresses the issues, it makes it seem as if the tests actually requrie this package -- instead of using the standard library -- and increases our external dependencies.

@@ -1,5 +1,5 @@
run:
deadline: 10m
timeout: 10m
Copy link
Member

Choose a reason for hiding this comment

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

This change seems reasonable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll file another PR for it

@klueska
Copy link
Contributor

klueska commented Apr 12, 2024

I don't feel strongly either way, but I do agree with the sentiment of not pulling in dependencies unless absolutely necessary. Could we move to crypto/rand instead?

@elezar
Copy link
Member

elezar commented Apr 12, 2024

If I recall correctly, switching to crypto/rand required a number of additional code changes and since these are _tests.go files and we're just using rand to generate a random integer:

			successAfter := rand.Intn(uniquePermutations(mc)) + 1

these changes are not required.

@tariq1890 tariq1890 closed this Apr 12, 2024
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