diff options
author | Emmanuel T Odeke <odeke@ualberta.ca> | 2021-09-19 04:18:30 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-19 12:18:30 +0200 |
commit | 7c21eca74f95b61d6813d0c0b155bf07c9aa8575 (patch) | |
tree | 4f07b3bca6573781552858667b5f4fc54afb7907 /resources/resource_test.go | |
parent | 13ad8408fc6b645b12898fb8053388fc4848dfbd (diff) | |
download | hugo-7c21eca74f95b61d6813d0c0b155bf07c9aa8575.tar.gz hugo-7c21eca74f95b61d6813d0c0b155bf07c9aa8575.zip |
resources: Use default math/rand.Source for concurrency safety
The source from NewSource is documented not to be safe for
concurrency, and instead use the eefault source which is documented
as safe.
Fixes #8981
Diffstat (limited to 'resources/resource_test.go')
-rw-r--r-- | resources/resource_test.go | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/resources/resource_test.go b/resources/resource_test.go index 571dd6de1..9823c064d 100644 --- a/resources/resource_test.go +++ b/resources/resource_test.go @@ -19,7 +19,6 @@ import ( "path/filepath" "strings" "testing" - "time" "github.com/spf13/afero" @@ -189,11 +188,10 @@ func TestResourcesGetMatch(t *testing.T) { func BenchmarkResourcesMatch(b *testing.B) { resources := benchResources(b) prefixes := []string{"abc*", "jkl*", "nomatch*", "sub/*"} - rnd := rand.New(rand.NewSource(time.Now().Unix())) b.RunParallel(func(pb *testing.PB) { for pb.Next() { - resources.Match(prefixes[rnd.Intn(len(prefixes))]) + resources.Match(prefixes[rand.Intn(len(prefixes))]) } }) } |