Skip to content

Commit 64939f6

Browse files
ianlancetaylorgopherbot
authored andcommitted
net/rpc: use reflect.TypeFor for known types
For #60088 Change-Id: I56586b68d5e38a46560f4ced19214f1d2db2850e Reviewed-on: https://go-review.googlesource.com/c/go/+/514995 Run-TryBot: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: David Chase <[email protected]> Reviewed-by: Rob Pike <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]>
1 parent f896659 commit 64939f6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/net/rpc/server.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,8 @@ const (
146146
DefaultDebugPath = "/debug/rpc"
147147
)
148148

149-
// Precompute the reflect type for error. Can't use error directly
150-
// because Typeof takes an empty interface value. This is annoying.
151-
var typeOfError = reflect.TypeOf((*error)(nil)).Elem()
149+
// Precompute the reflect type for error.
150+
var typeOfError = reflect.TypeFor[error]()
152151

153152
type methodType struct {
154153
sync.Mutex // protects counters

0 commit comments

Comments
 (0)