Skip to content

[8.x](backport #42513) chore: add linter that catches math/rand imports#42600

Merged
mauri870 merged 1 commit into8.xfrom
mergify/bp/8.x/pr-42513
Feb 5, 2025
Merged

[8.x](backport #42513) chore: add linter that catches math/rand imports#42600
mauri870 merged 1 commit into8.xfrom
mergify/bp/8.x/pr-42513

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify bot commented Feb 5, 2025

Proposed commit message

This is a follow up to #42025 that migrated from math/rand to the newer math/rand/v2 package. Currently there is nothing preventing contributors to commiting code using math/rand and regressing these changes.

There is still code in beats that use math/rand, but it is mainly in tests. Since the linter only runs on new code I'm not fixing it here.

Introduce 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:

filebeat/input/filestream/internal/task/group_test.go:24:2: import 'math/rand' is not allowed from list 'main': superseded by math/rand/v2 (depguard)
        "math/rand"

This is an automatic backport of pull request #42513 done by [Mergify](https://mergify.com).

@mergify mergify bot requested a review from a team as a code owner February 5, 2025 13:43
@mergify mergify bot added the backport label Feb 5, 2025
@mergify mergify bot requested review from faec and mauri870 and removed request for a team February 5, 2025 13:43
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Feb 5, 2025
@github-actions github-actions bot added cleanup Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels Feb 5, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Feb 5, 2025
@mauri870 mauri870 requested review from mauri870 and removed request for faec February 5, 2025 14:03
@mauri870 mauri870 merged commit dee3ade into 8.x Feb 5, 2025
@mauri870 mauri870 deleted the mergify/bp/8.x/pr-42513 branch February 5, 2025 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport cleanup 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.

2 participants