Skip to content

Commit

Permalink
deprecate unneeded utils.Testing (#4350)
Browse files Browse the repository at this point in the history
  • Loading branch information
abe-winter authored Sep 6, 2024
1 parent 23a998b commit 3b5bc06
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions utils/value.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package utils

import (
"flag"
"math/rand"
"os"
"strings"
"testing"
)

// AssertType attempts to assert that the given interface argument is
Expand Down Expand Up @@ -46,9 +46,9 @@ type Rand interface {
}

// Testing returns true when you are running in test suite.
// Deprecated: this is in the standard library now.
func Testing() bool {
// TODO switch to official testing.Testing method when we are on go 1.21
return flag.Lookup("test.v") != nil
return testing.Testing()
}

// randWrapper is a pass-through to the shared math/rand functions.
Expand All @@ -61,7 +61,7 @@ func (randWrapper) Float64() float64 {
// SafeTestingRand returns a wrapper around the shared math/rand source in prod,
// and a deterministic rand.Rand seeded with 0 in test.
func SafeTestingRand() Rand {
if Testing() {
if testing.Testing() {
return rand.New(rand.NewSource(0)) //nolint:gosec
}
return randWrapper{}
Expand Down

0 comments on commit 3b5bc06

Please sign in to comment.