From 5e4322936e6b029e0c8e651f7623a09988b0c037 Mon Sep 17 00:00:00 2001 From: Raphael 'kena' Poss Date: Wed, 14 Oct 2020 16:18:07 +0200 Subject: [PATCH] *: misc go 1.15 linter fixes To construct a single-rune string the compiler now only accepts `string(rune(x))` not just `string(x)`. Release note: None --- pkg/ccl/changefeedccl/name_test.go | 8 ++++---- pkg/kv/kvclient/kvcoord/dist_sender_test.go | 4 ++-- pkg/kv/kvserver/concurrency/lock_table_test.go | 4 ++-- pkg/util/encoding/encoding_test.go | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/ccl/changefeedccl/name_test.go b/pkg/ccl/changefeedccl/name_test.go index ca53f8f5de72..82309ca908ea 100644 --- a/pkg/ccl/changefeedccl/name_test.go +++ b/pkg/ccl/changefeedccl/name_test.go @@ -37,8 +37,8 @@ func TestSQLNameToKafkaName(t *testing.T) { {`/`, `_u002f_`}, {`☃`, `_u2603_`}, {"\x00", `_u0000_`}, - {string(utf8.RuneSelf), `_u0080_`}, - {string(utf8.MaxRune), `_u0010ffff_`}, + {string(rune(utf8.RuneSelf)), `_u0080_`}, + {string(rune(utf8.MaxRune)), `_u0010ffff_`}, // special case: exact match of . and .. are disallowed by kafka {`.`, `_u002e_`}, {`..`, `_u002e__u002e_`}, @@ -77,8 +77,8 @@ func TestSQLNameToAvroName(t *testing.T) { {`/`, `_u002f_`}, {`☃`, `_u2603_`}, {"\x00", `_u0000_`}, - {string(utf8.RuneSelf), `_u0080_`}, - {string(utf8.MaxRune), `_u0010ffff_`}, + {string(rune(utf8.RuneSelf)), `_u0080_`}, + {string(rune(utf8.MaxRune)), `_u0010ffff_`}, } for i, test := range tests { if a := SQLNameToAvroName(test.sql); a != test.avro { diff --git a/pkg/kv/kvclient/kvcoord/dist_sender_test.go b/pkg/kv/kvclient/kvcoord/dist_sender_test.go index 47e99e4672b6..b76a7dd74839 100644 --- a/pkg/kv/kvclient/kvcoord/dist_sender_test.go +++ b/pkg/kv/kvclient/kvcoord/dist_sender_test.go @@ -2932,11 +2932,11 @@ func TestCountRanges(t *testing.T) { for i := range descriptors { startKey := testMetaEndKey if i > 0 { - startKey = roachpb.RKey(string(firstKeyBoundary + i - 1)) + startKey = roachpb.RKey(string(rune(firstKeyBoundary + i - 1))) } endKey := roachpb.RKeyMax if i < len(descriptors)-1 { - endKey = roachpb.RKey(string(firstKeyBoundary + i)) + endKey = roachpb.RKey(string(rune(firstKeyBoundary + i))) } descriptors[i] = roachpb.RangeDescriptor{ diff --git a/pkg/kv/kvserver/concurrency/lock_table_test.go b/pkg/kv/kvserver/concurrency/lock_table_test.go index bc8ad0ca21a7..87757d2efa59 100644 --- a/pkg/kv/kvserver/concurrency/lock_table_test.go +++ b/pkg/kv/kvserver/concurrency/lock_table_test.go @@ -887,7 +887,7 @@ func TestLockTableConcurrentSingleRequests(t *testing.T) { } var keys []roachpb.Key for i := 0; i < 10; i++ { - keys = append(keys, roachpb.Key(string('a'+i))) + keys = append(keys, roachpb.Key(string(rune('a'+i)))) } rng := rand.New(rand.NewSource(uint64(timeutil.Now().UnixNano()))) @@ -960,7 +960,7 @@ func TestLockTableConcurrentRequests(t *testing.T) { } var keys []roachpb.Key for i := 0; i < 10; i++ { - keys = append(keys, roachpb.Key(string('a'+i))) + keys = append(keys, roachpb.Key(string(rune('a'+i)))) } rng := rand.New(rand.NewSource(uint64(timeutil.Now().UnixNano()))) const numActiveTxns = 8 diff --git a/pkg/util/encoding/encoding_test.go b/pkg/util/encoding/encoding_test.go index dfc4284c50ab..b02f3e4e71ce 100644 --- a/pkg/util/encoding/encoding_test.go +++ b/pkg/util/encoding/encoding_test.go @@ -1502,7 +1502,7 @@ func BenchmarkPeekType(b *testing.B) { for i := 0; i < b.N; i++ { typ = PeekType(buf) } - sink = string(typ) + sink = fmt.Sprint(typ) } type randData struct {