diff options
| author | apocelipes <seve3r@outlook.com> | 2025-09-17 09:47:20 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-09-17 08:48:07 -0700 |
| commit | 3db5979e8cc4cc86c4fefb4cecc5a2041b32404d (patch) | |
| tree | a81d2b04af5cea20015d6329e1953423ee68e592 /src/testing/quick | |
| parent | 6a8dbbecbfc32650841e737271384ffaba433292 (diff) | |
| download | go-3db5979e8cc4cc86c4fefb4cecc5a2041b32404d.tar.xz | |
testing: use reflect.TypeAssert and reflect.TypeFor
To simplify the code.
Updates #62121
Updates #60088
Change-Id: I1cef27b19961721b89a965c708320072a052d9af
GitHub-Last-Rev: ffd07a74da87b84b457246b2c94d4ee7540c8e8b
GitHub-Pull-Request: golang/go#75494
Reviewed-on: https://go-review.googlesource.com/c/go/+/704575
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/testing/quick')
| -rw-r--r-- | src/testing/quick/quick.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/testing/quick/quick.go b/src/testing/quick/quick.go index 8ef9cf7dda..6b3089d049 100644 --- a/src/testing/quick/quick.go +++ b/src/testing/quick/quick.go @@ -64,7 +64,7 @@ func Value(t reflect.Type, rand *rand.Rand) (value reflect.Value, ok bool) { // hint is used for shrinking as a function of indirection level so // that recursive data structures will terminate. func sizedValue(t reflect.Type, rand *rand.Rand, size int) (value reflect.Value, ok bool) { - if m, ok := reflect.Zero(t).Interface().(Generator); ok { + if m, ok := reflect.TypeAssert[Generator](reflect.Zero(t)); ok { return m.Generate(rand, size), true } |
