Skip to content

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

Merged
mauri870 merged 2 commits intoelastic:mainfrom
mauri870:golanci-lint-math-rand
Feb 3, 2025
Merged

chore: add linter that denies importing math/rand#270
mauri870 merged 2 commits intoelastic:mainfrom
mauri870:golanci-lint-math-rand

Conversation

@mauri870
Copy link
Copy Markdown
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
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @mauri870

@mauri870 mauri870 merged commit 4518e1e into elastic:main Feb 3, 2025
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