Skip to content

Commit

Permalink
chore: add linter that denies importing math/rand (#6650) (#6657)
Browse files Browse the repository at this point in the history
(cherry picked from commit cc84f9e)

Co-authored-by: Mauri de Souza Meneguzzo <[email protected]>
  • Loading branch information
mergify[bot] and mauri870 authored Jan 31, 2025
1 parent d6beeac commit de0cc30
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ linters:
- noctx # noctx finds sending http request without context.Context
- unconvert # Remove unnecessary type conversions
- wastedassign # wastedassign finds wasted assignment statements.
- gomodguard # check for blocked dependencies
- depguard # check for blocked imports from Go files
- gomodguard # check for blocked imports from go.mod
- gomoddirectives

# all available settings of specific linters
Expand Down Expand Up @@ -88,9 +89,9 @@ linters-settings:
goimports:
local-prefixes: github.com/elastic

# Check for blocked dependencies in go.mod.
gomodguard:
blocked:
# List of blocked modules.
modules:
# Blocked module.
- github.com/pkg/errors:
Expand All @@ -105,6 +106,15 @@ linters-settings:
- github.com/gofrs/uuid/v5
reason: "Use one uuid library consistently across the codebase"

# Check for blocked imports in Go files.
depguard:
rules:
main:
list-mode: lax
deny:
- pkg: "math/rand$"
desc: "superseded by math/rand/v2"

gomoddirectives:
# Forbid local `replace` directives
replace-local: false
Expand Down

0 comments on commit de0cc30

Please sign in to comment.