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 <richard.wall@jetstack.io>
This commit is contained in:
Richard Wall
2021-05-04 14:26:43 +01:00
parent c7514d9262
commit 2eece85082
+1 -1
View File
@@ -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
}