aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcuishuang <imcusg@gmail.com>2025-10-05 15:42:14 +0800
committerGopher Robot <gobot@golang.org>2025-10-09 11:10:29 -0700
commit0b7aa0cfb07b6b13ead990b67cb3cb8639871f90 (patch)
treec81e419267045e797a0c0cf2dd0bc02e22f1d688
parent1faea2975ced2153e5086c1ee135f983db10150a (diff)
downloadgo-x-crypto-0b7aa0cfb07b6b13ead990b67cb3cb8639871f90.tar.xz
ssh: use reflect.TypeFor instead of reflect.TypeOf
For golang/go#60088. Change-Id: I58994c469a2793516214ab1a0072fb6137afc46e Reviewed-on: https://go-review.googlesource.com/c/crypto/+/709156 Auto-Submit: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicola Murino <nicola.murino@gmail.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Sean Liao <sean@liao.dev>
-rw-r--r--ssh/messages.go2
-rw-r--r--ssh/messages_test.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/ssh/messages.go b/ssh/messages.go
index 251b9d0..ab22c3d 100644
--- a/ssh/messages.go
+++ b/ssh/messages.go
@@ -792,7 +792,7 @@ func marshalString(to []byte, s []byte) []byte {
return to[len(s):]
}
-var bigIntType = reflect.TypeOf((*big.Int)(nil))
+var bigIntType = reflect.TypeFor[*big.Int]()
// Decode a packet into its corresponding message.
func decode(packet []byte) (interface{}, error) {
diff --git a/ssh/messages_test.go b/ssh/messages_test.go
index d8691bd..ed34628 100644
--- a/ssh/messages_test.go
+++ b/ssh/messages_test.go
@@ -257,7 +257,7 @@ func TestDecode(t *testing.T) {
userAuthSuccess, err := decode([]byte{msgUserAuthSuccess})
if err != nil {
t.Errorf("error decoding userAuthSuccessMsg")
- } else if reflect.TypeOf(userAuthSuccess) != reflect.TypeOf((*userAuthSuccessMsg)(nil)) {
+ } else if _, ok := userAuthSuccess.(*userAuthSuccessMsg); !ok {
t.Errorf("error decoding userAuthSuccessMsg, unexpected %T", userAuthSuccess)
}
}