From 7fd9756981404178e3df0e8173bad7741a3a16f1 Mon Sep 17 00:00:00 2001 From: Timofey Koolin Date: Fri, 15 Dec 2023 16:40:51 +0300 Subject: [PATCH] fix linter --- internal/grpcwrapper/rawtopic/rawtopicwriter/messages.go | 6 +++--- internal/topic/topicreaderinternal/batch.go | 4 ++-- .../topic/topicwriterinternal/writer_reconnector_test.go | 1 - 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/grpcwrapper/rawtopic/rawtopicwriter/messages.go b/internal/grpcwrapper/rawtopic/rawtopicwriter/messages.go index 7c4b466ce..c943506fa 100644 --- a/internal/grpcwrapper/rawtopic/rawtopicwriter/messages.go +++ b/internal/grpcwrapper/rawtopic/rawtopicwriter/messages.go @@ -187,10 +187,10 @@ func (d *MessageData) ToProto() (*Ydb_Topic.StreamWriteMessage_WriteRequest_Mess return nil, err } - for _, item := range d.MetadataItems { + for i := range d.MetadataItems { res.MetadataItems = append(res.MetadataItems, &Ydb_Topic.MetadataItem{ - Key: item.Key, - Value: item.Value, + Key: d.MetadataItems[i].Key, + Value: d.MetadataItems[i].Value, }) } diff --git a/internal/topic/topicreaderinternal/batch.go b/internal/topic/topicreaderinternal/batch.go index f1edfab3a..14283d0fe 100644 --- a/internal/topic/topicreaderinternal/batch.go +++ b/internal/topic/topicreaderinternal/batch.go @@ -88,8 +88,8 @@ func newBatchFromStream( if len(sMess.MetadataItems) > 0 { dstMess.Metadata = make(map[string][]byte, len(sMess.MetadataItems)) - for _, item := range sMess.MetadataItems { - dstMess.Metadata[item.Key] = item.Value + for metadataIndex := range sMess.MetadataItems { + dstMess.Metadata[sMess.MetadataItems[metadataIndex].Key] = sMess.MetadataItems[metadataIndex].Value } } diff --git a/internal/topic/topicwriterinternal/writer_reconnector_test.go b/internal/topic/topicwriterinternal/writer_reconnector_test.go index a1c5572f3..a029154c7 100644 --- a/internal/topic/topicwriterinternal/writer_reconnector_test.go +++ b/internal/topic/topicwriterinternal/writer_reconnector_test.go @@ -108,7 +108,6 @@ func TestWriterImpl_Write(t *testing.T) { require.NoError(t, err) mess.metadataCached = true expectedMap[k] = mess - } require.Equal(t, expectedMap, w.queue.messagesByOrder)