diff options
author | Justin Tobler <jtobler@gitlab.com> | 2023-07-21 00:07:24 +0300 |
---|---|---|
committer | Justin Tobler <jtobler@gitlab.com> | 2023-07-21 00:14:02 +0300 |
commit | c4779a9fc09c7b43abcf6c8224ae58760e0bad24 (patch) | |
tree | 69a4d0def1ecba26e96cc8a3fbebb49e2111afef /internal/streamcache | |
parent | 64b6bf6121ba685308a1b64ad20164e633d8e411 (diff) |
Replace `math/rand` `Read()` callsites with `crypto/rand`
In Go 1.20, the `math/rand` package `Read()` function is deprecated. To
avoid linter errors update callsites to use `Read()` from the
`crypto/rand` package.
Diffstat (limited to 'internal/streamcache')
-rw-r--r-- | internal/streamcache/cache_test.go | 5 | ||||
-rw-r--r-- | internal/streamcache/pipe_test.go | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/internal/streamcache/cache_test.go b/internal/streamcache/cache_test.go index d0007ec7a..4e66e13c8 100644 --- a/internal/streamcache/cache_test.go +++ b/internal/streamcache/cache_test.go @@ -3,10 +3,11 @@ package streamcache import ( "bytes" "context" + "crypto/rand" "errors" "fmt" "io" - "math/rand" + mathrand "math/rand" "os" "path/filepath" "strings" @@ -220,7 +221,7 @@ func TestCache_scope(t *testing.T) { // be order dependent, e.g. "last write wins". We could reverse the order // now to catch that possible bug, but then we only test for one kind of // bug. Let's shuffle instead, which can catch more hypothetical bugs. - rand.Shuffle(N, func(i, j int) { + mathrand.Shuffle(N, func(i, j int) { output[i], output[j] = output[j], output[i] input[i], input[j] = input[j], input[i] }) diff --git a/internal/streamcache/pipe_test.go b/internal/streamcache/pipe_test.go index 96d59863c..e4cff8085 100644 --- a/internal/streamcache/pipe_test.go +++ b/internal/streamcache/pipe_test.go @@ -2,8 +2,8 @@ package streamcache import ( "bytes" + "crypto/rand" "io" - "math/rand" "os" "path/filepath" "sync" |