Skip to content

Commit 0b7aa0c

Browse files
cuishuanggopherbot
authored andcommitted
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>
1 parent 1faea29 commit 0b7aa0c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ssh/messages.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ func marshalString(to []byte, s []byte) []byte {
792792
return to[len(s):]
793793
}
794794

795-
var bigIntType = reflect.TypeOf((*big.Int)(nil))
795+
var bigIntType = reflect.TypeFor[*big.Int]()
796796

797797
// Decode a packet into its corresponding message.
798798
func decode(packet []byte) (interface{}, error) {

ssh/messages_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func TestDecode(t *testing.T) {
257257
userAuthSuccess, err := decode([]byte{msgUserAuthSuccess})
258258
if err != nil {
259259
t.Errorf("error decoding userAuthSuccessMsg")
260-
} else if reflect.TypeOf(userAuthSuccess) != reflect.TypeOf((*userAuthSuccessMsg)(nil)) {
260+
} else if _, ok := userAuthSuccess.(*userAuthSuccessMsg); !ok {
261261
t.Errorf("error decoding userAuthSuccessMsg, unexpected %T", userAuthSuccess)
262262
}
263263
}

0 commit comments

Comments
 (0)