Skip to content

Commit

Permalink
*: misc go 1.15 linter fixes
Browse files Browse the repository at this point in the history
To construct a single-rune string the compiler now only accepts
`string(rune(x))` not just `string(x)`.

Release note: None
  • Loading branch information
knz authored and andreimatei committed Dec 10, 2020
1 parent 4489e63 commit 5e43229
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions pkg/ccl/changefeedccl/name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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_`},
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/kv/kvclient/kvcoord/dist_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
4 changes: 2 additions & 2 deletions pkg/kv/kvserver/concurrency/lock_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())))

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/encoding/encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5e43229

Please sign in to comment.