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

chore: add linter that denies importing math/rand #270

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

mauri870
Copy link
Member

@mauri870 mauri870 commented Jan 30, 2025

Proposed commit message

In order to ensure consistency between beats, elastic-agent and libs this commit migrates from math/rand to the newer math/rand/v2 package as well as introducing a linter that catches math/rand imports in Go files.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

Logs

Offending code gets warned like this:

file.go:24:2: import 'math/rand' is not allowed from list 'main': superseded by math/rand/v2 (depguard)
        "math/rand"

@mauri870 mauri870 added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Jan 30, 2025
@mauri870 mauri870 self-assigned this Jan 30, 2025
@mauri870 mauri870 requested a review from a team as a code owner January 30, 2025 19:12
@mauri870 mauri870 requested review from AndersonQ and khushijain21 and removed request for a team January 30, 2025 19:12
@mauri870 mauri870 enabled auto-merge (squash) February 3, 2025 11:37
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mauri870

@mauri870 mauri870 merged commit 4518e1e into elastic:main Feb 3, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants