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
"path/filepath"
"strings"
"testing"
- "time"
"github.com/spf13/afero"
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))])
}
})
}