diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-02-24 18:35:17 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-02-26 04:38:19 +0000 |
commit | 6052838bc325049505aba9c3b87256161f9e05e8 (patch) | |
tree | 5d566da7ff0796abd2eb08c168ac2547948fac67 /src/runtime/string_test.go | |
parent | c46ffdd2eca339918ed30b6ba9d4715ba769d35d (diff) | |
download | go-6052838bc325049505aba9c3b87256161f9e05e8.tar.gz go-6052838bc325049505aba9c3b87256161f9e05e8.zip |
all: avoid string(i) where i has type int
Instead use string(r) where r has type rune.
This is in preparation for a vet warning for string(i).
Updates #32479
Change-Id: Ic205269bba1bd41723950219ecfb67ce17a7aa79
Reviewed-on: https://go-review.googlesource.com/c/go/+/220844
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Akhil Indurti <aindurti@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Toshihiro Shiino <shiino.toshihiro@gmail.com>
Diffstat (limited to 'src/runtime/string_test.go')
-rw-r--r-- | src/runtime/string_test.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/string_test.go b/src/runtime/string_test.go index 80c5fa6406..b9ac667533 100644 --- a/src/runtime/string_test.go +++ b/src/runtime/string_test.go @@ -282,7 +282,7 @@ func TestStringOnStack(t *testing.T) { func TestIntString(t *testing.T) { // Non-escaping result of intstring. s := "" - for i := 0; i < 4; i++ { + for i := rune(0); i < 4; i++ { s += string(i+'0') + string(i+'0'+1) } if want := "01122334"; s != want { @@ -291,7 +291,7 @@ func TestIntString(t *testing.T) { // Escaping result of intstring. var a [4]string - for i := 0; i < 4; i++ { + for i := rune(0); i < 4; i++ { a[i] = string(i + '0') } s = a[0] + a[1] + a[2] + a[3] |