aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcui fliter <imcusg@gmail.com>2023-08-02 16:38:12 +0800
committerGopher Robot <gobot@golang.org>2023-08-07 00:25:49 +0000
commit2d2662f8d0b50d123da2f6674308cf5e0c21e062 (patch)
tree66cb0645b56a062b5850d4c93876b090614adc62 /src
parent834a3f844a77823bf57c323d0927bc1f42b10e61 (diff)
downloadgo-2d2662f8d0b50d123da2f6674308cf5e0c21e062.tar.xz
cmd/fix: use reflect.TypeFor for known types
For #60088 Change-Id: Id19435e864bcfd2adbb1492db3f8cdf2ee3c915e Reviewed-on: https://go-review.googlesource.com/c/go/+/515175 Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: shuang cui <imcusg@gmail.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/fix/cftype.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/fix/cftype.go b/src/cmd/fix/cftype.go
index e4988b1c62..d4fcc4485e 100644
--- a/src/cmd/fix/cftype.go
+++ b/src/cmd/fix/cftype.go
@@ -60,8 +60,8 @@ func typefix(f *ast.File, badType func(string) bool) bool {
// There's no easy way to map from an ast.Expr to all the places that use them, so
// we use reflect to find all such references.
if len(badNils) > 0 {
- exprType := reflect.TypeOf((*ast.Expr)(nil)).Elem()
- exprSliceType := reflect.TypeOf(([]ast.Expr)(nil))
+ exprType := reflect.TypeFor[ast.Expr]()
+ exprSliceType := reflect.TypeFor[[]ast.Expr]()
walk(f, func(n any) {
if n == nil {
return