From 7acacf1dc338e15e58aac919814866bca236e238 Mon Sep 17 00:00:00 2001 From: Victor Lyuboslavsky <2685025+getvictor@users.noreply.github.com> Date: Thu, 2 Apr 2026 13:20:43 -0500 Subject: [PATCH] Claude, use math/rand/v2 instead of math/rand (#42861) This will only fire if Claude adds `math/rand` as an import. ## Summary by CodeRabbit * **Chores** * Updated code style guidelines and enhanced linting configuration to enforce stricter code quality standards. --- .claude/CLAUDE.md | 1 + .golangci-incremental.yml | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md index b519e2f6ea..baabffad35 100644 --- a/.claude/CLAUDE.md +++ b/.claude/CLAUDE.md @@ -23,3 +23,4 @@ MYSQL_TEST=1 go test -run TestFunctionName ./server/datastore/mysql/... - Use `require` and `assert` from `github.com/stretchr/testify` in tests. - Use `t.Context()` in tests instead of `context.Background()`. - Use `any` instead of `interface{}` +- Use `math/rand/v2` instead of `math/rand`. diff --git a/.golangci-incremental.yml b/.golangci-incremental.yml index 55392dadaf..a6066bfd05 100644 --- a/.golangci-incremental.yml +++ b/.golangci-incremental.yml @@ -15,6 +15,7 @@ linters: - testifylint - nilaway - setboolcheck + - depguard settings: gosec: # Only enable rules that are too noisy on existing code but valuable for new code. @@ -31,6 +32,13 @@ linters: - G704 # SSRF via taint analysis. - G705 # XSS via taint analysis. - G706 # Log injection via taint analysis. + depguard: + rules: + no-old-rand: + list-mode: lax + deny: + - pkg: math/rand$ + desc: Use math/rand/v2 instead custom: nilaway: type: module