pkg/chunkenc: fix test using string(int) conversion (#2647)

Since go1.15, there's a new vet check for code such as string(x) where x
has an integer type other than rune.  This vet check is enabled by
default on go test.

TestSerialization failed because of that, this commit replaces `string()`
conversions with `strconv.Itoa` calls

Fixes #2646
pull/2655/head
Aurélien Rainone 5 years ago committed by GitHub
parent 9e85757d89
commit 85696d00eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      pkg/chunkenc/memchunk_test.go

@ -7,6 +7,7 @@ import (
"fmt"
"math"
"math/rand"
"strconv"
"strings"
"testing"
"time"
@ -255,7 +256,7 @@ func TestSerialization(t *testing.T) {
numSamples := 50000
for i := 0; i < numSamples; i++ {
require.NoError(t, chk.Append(logprotoEntry(int64(i), string(i))))
require.NoError(t, chk.Append(logprotoEntry(int64(i), strconv.Itoa(i))))
}
byt, err := chk.Bytes()
@ -271,7 +272,7 @@ func TestSerialization(t *testing.T) {
e := it.Entry()
require.Equal(t, int64(i), e.Timestamp.UnixNano())
require.Equal(t, string(i), e.Line)
require.Equal(t, strconv.Itoa(i), e.Line)
}
require.NoError(t, it.Error())

Loading…
Cancel
Save