From fb1dbdc05ea9fabd7f953f17e4c169995c200489 Mon Sep 17 00:00:00 2001 From: guangwu Date: Mon, 11 Dec 2023 21:15:47 +0800 Subject: [PATCH] chore: use bytes.Equal instead (#4201) --- pkg/query-service/app/opamp/model/agent.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/query-service/app/opamp/model/agent.go b/pkg/query-service/app/opamp/model/agent.go index a6f9dd66ef..758531f345 100644 --- a/pkg/query-service/app/opamp/model/agent.go +++ b/pkg/query-service/app/opamp/model/agent.go @@ -259,7 +259,7 @@ func (agent *Agent) processStatusUpdate( // send the new remote config to the Agent. if configChanged || (agent.Status.RemoteConfigStatus != nil && - bytes.Compare(agent.Status.RemoteConfigStatus.LastRemoteConfigHash, agent.remoteConfig.ConfigHash) != 0) { + !bytes.Equal(agent.Status.RemoteConfigStatus.LastRemoteConfigHash, agent.remoteConfig.ConfigHash)) { // The new status resulted in a change in the config of the Agent or the Agent // does not have this config (hash is different). Send the new config the Agent. response.RemoteConfig = agent.remoteConfig @@ -352,7 +352,7 @@ func isEqualConfigFile(f1, f2 *protobufs.AgentConfigFile) bool { if f1 == nil || f2 == nil { return false } - return bytes.Compare(f1.Body, f2.Body) == 0 && f1.ContentType == f2.ContentType + return bytes.Equal(f1.Body, f2.Body) && f1.ContentType == f2.ContentType } func (agent *Agent) SendToAgent(msg *protobufs.ServerToAgent) {