From 383b0c176c053cb70ef05cbc4e73bcd420c495e7 Mon Sep 17 00:00:00 2001 From: Wang Guoliang Date: Wed, 13 Sep 2017 20:58:14 +0800 Subject: [PATCH] optimization:use bytes.Equal instead of bytes.Compare --- communicator/ssh/communicator_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/communicator/ssh/communicator_test.go b/communicator/ssh/communicator_test.go index 3f9d4f8839..b2344fa558 100644 --- a/communicator/ssh/communicator_test.go +++ b/communicator/ssh/communicator_test.go @@ -381,7 +381,7 @@ func acceptPublicKey(keystr string) func(ssh.ConnMetadata, ssh.PublicKey) (*ssh. panic(fmt.Errorf("error parsing key: %s", err)) } return func(_ ssh.ConnMetadata, inkey ssh.PublicKey) (*ssh.Permissions, error) { - if bytes.Compare(inkey.Marshal(), goodkey.Marshal()) == 0 { + if bytes.Equal(inkey.Marshal(), goodkey.Marshal()) { return nil, nil }