From 3860b2764ff25e103fbe1db40f22248fe7a6dc20 Mon Sep 17 00:00:00 2001 From: Christian Persson Date: Thu, 24 Sep 2020 23:05:11 +0200 Subject: [PATCH] proto: convert integer to rune before converting to string (#1210) Go 1.15 introduced a new `go vet` warning (https://golang.org/doc/go1.15#vet) for conversions of the form `string(x)` where `x` is an integer type other than `rune` or `byte`. This warning is enabled by default when running `go test`. As a consequence, running `go test github.com/golang/protobuf/proto` results in a build failure prior to this commit. --- proto/text_decode.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/text_decode.go b/proto/text_decode.go index 4a59310098..47eb3e4450 100644 --- a/proto/text_decode.go +++ b/proto/text_decode.go @@ -765,7 +765,7 @@ func unescape(s string) (ch string, tail string, err error) { if i > utf8.MaxRune { return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) } - return string(i), s, nil + return string(rune(i)), s, nil } return "", "", fmt.Errorf(`unknown escape \%c`, r) }