diff --git a/.golangci.yml b/.golangci.yml index 6047e1829ba..bcfef9a3d8f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -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 @@ -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: @@ -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