Skip to content

Commit

Permalink
pkg/chunkenc: fix test using string(int) conversion (#2647)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
arl authored Sep 21, 2020
1 parent 9e85757 commit 85696d0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/chunkenc/memchunk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"math"
"math/rand"
"strconv"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -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()
Expand All @@ -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())

Expand Down

0 comments on commit 85696d0

Please sign in to comment.