From 8235474ce29a203d104c2258030b37fd259d3ee9 Mon Sep 17 00:00:00 2001 From: Lukasz Antoniak Date: Wed, 19 Jun 2024 18:51:57 +0200 Subject: [PATCH] Refactor deep copy code --- go.mod | 2 +- proxy/codecs.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 4e58d65..1e401a7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/datastax/cql-proxy -go 1.16 +go 1.18 require ( github.com/alecthomas/kong v0.2.17 diff --git a/proxy/codecs.go b/proxy/codecs.go index caed68b..bdab69f 100644 --- a/proxy/codecs.go +++ b/proxy/codecs.go @@ -79,9 +79,9 @@ func (m *partialExecute) GetOpCode() primitive.OpCode { } func (m *partialExecute) DeepCopyMessage() message.Message { - return &partialExecute{ - queryId: append(m.queryId[:0:0], m.queryId...), - } + queryId := make([]byte, len(m.queryId)) + copy(queryId, m.queryId) + return &partialExecute{queryId} } func (m *partialExecute) String() string {