Skip to content

Commit cfaacaa

Browse files
committed
Prefer math/rand/v2 over the math/rand package
1 parent c95679a commit cfaacaa

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.golangci.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ linters:
7575
desc: Use "go.opentelemetry.io/otel/semconv/v1.27.0" instead.
7676
- pkg: io/ioutil
7777
desc: Use the "io" and "os" packages instead. See https://go.dev/doc/go1.16#ioutil
78+
- pkg: math/rand$
79+
desc: Use the "math/rand/v2" package instead. See https://go.dev/doc/go1.22#math_rand_v2
7880
not-tests:
7981
files: ['!$test','!**/internal/testing/**']
8082
list-mode: lax
@@ -139,6 +141,11 @@ linters:
139141
- legacy
140142
- std-error-handling
141143
rules:
144+
# It is fine for tests to use "math/rand" packages.
145+
- linters: [gosec]
146+
path: '(.+)_test[.]go'
147+
text: weak random number generator
148+
142149
# This internal package is the one place we want to do API discovery.
143150
- linters: [depguard]
144151
path: internal/kubernetes/discovery.go

internal/pgbackrest/util_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package pgbackrest
66

77
import (
88
"io"
9-
"math/rand"
9+
"math/rand/v2"
1010
"strconv"
1111
"testing"
1212

0 commit comments

Comments
 (0)