From d8c0e9e0fbeb7bd7ca94b1d0b9986c54d2c5ad6d Mon Sep 17 00:00:00 2001 From: Vilius Pranckaitis Date: Tue, 19 Jan 2021 14:01:27 +0200 Subject: [PATCH] Replace bytes.Compare() == 0 with bytes.Equal() --- src/dbnode/storage/index.go | 4 ++-- src/query/models/tags.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dbnode/storage/index.go b/src/dbnode/storage/index.go index df35e4dd80..64d285f701 100644 --- a/src/dbnode/storage/index.go +++ b/src/dbnode/storage/index.go @@ -692,8 +692,8 @@ func (i *nsIndex) writeBatches( for _, matchField := range i.doNotIndexWithFields { matchedField := false for _, actualField := range d.Fields { - if bytes.Compare(actualField.Name, matchField.Name) == 0 { - matchedField = bytes.Compare(actualField.Value, matchField.Value) == 0 + if bytes.Equal(actualField.Name, matchField.Name) { + matchedField = bytes.Equal(actualField.Value, matchField.Value) break } } diff --git a/src/query/models/tags.go b/src/query/models/tags.go index 5f20e84884..03658757cd 100644 --- a/src/query/models/tags.go +++ b/src/query/models/tags.go @@ -306,7 +306,7 @@ func (t Tags) validate() error { } prev := tags.Tags[i-1] - if bytes.Compare(prev.Name, tag.Name) == 0 { + if bytes.Equal(prev.Name, tag.Name) { return fmt.Errorf("tags duplicate: '%s' appears more than once", tags.Tags[i-1].Name) }