Skip to content

Commit 3860b27

Browse files
authored
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.
1 parent d04d7b1 commit 3860b27

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

proto/text_decode.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ func unescape(s string) (ch string, tail string, err error) {
765765
if i > utf8.MaxRune {
766766
return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss)
767767
}
768-
return string(i), s, nil
768+
return string(rune(i)), s, nil
769769
}
770770
return "", "", fmt.Errorf(`unknown escape \%c`, r)
771771
}

0 commit comments

Comments
 (0)