From 2eece85082fa043168c174561ba7696069218df1 Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Tue, 4 May 2021 14:20:27 +0100 Subject: [PATCH] Use bytes.Equal instead of bytes.Compare pkg/webhook/server/tls/file_source.go:140:5: should use bytes.Equal(keyData, f.cachedKeyBytes) instead (S1004) pkg/webhook/server/tls/file_source.go:140:54: should use bytes.Equal(certData, f.cachedCertBytes) instead (S1004) Signed-off-by: Richard Wall --- pkg/webhook/server/tls/file_source.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/webhook/server/tls/file_source.go b/pkg/webhook/server/tls/file_source.go index afc715ba9..fbe48ba81 100644 --- a/pkg/webhook/server/tls/file_source.go +++ b/pkg/webhook/server/tls/file_source.go @@ -137,7 +137,7 @@ func (f *FileCertificateSource) updateCertificateFromDisk() error { f.lock.Lock() defer f.lock.Unlock() - if bytes.Compare(keyData, f.cachedKeyBytes) == 0 && bytes.Compare(certData, f.cachedCertBytes) == 0 { + if bytes.Equal(keyData, f.cachedKeyBytes) && bytes.Equal(certData, f.cachedCertBytes) { f.Log.V(logf.DebugLevel).Info("key and certificate on disk have not changed") return nil }