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>
This commit is contained in:
cuishuang
2025-10-09 11:10:29 -07:00
committed by Gopher Robot
parent 1faea2975c
commit 0b7aa0cfb0
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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)
}
}