From 26e8bcb3c743193558d1a0ff540c9e05f999267d Mon Sep 17 00:00:00 2001 From: Emmanuel T Odeke Date: Sat, 20 Nov 2021 17:03:45 +0100 Subject: [PATCH] all: remove unnecessary string([]byte) conversion in fmt.Sprintf with %s Change-Id: I64aab811cbcbfa410817894f1cd1d83f88f27bf6 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/365874 Reviewed-by: Damien Neil Trust: Damien Neil Trust: Emmanuel Odeke --- internal/encoding/text/decode.go | 2 +- testing/prototest/message.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/encoding/text/decode.go b/internal/encoding/text/decode.go index eb10ea102..37803773f 100644 --- a/internal/encoding/text/decode.go +++ b/internal/encoding/text/decode.go @@ -381,7 +381,7 @@ func (d *Decoder) currentOpenKind() (Kind, byte) { case '[': return ListOpen, ']' } - panic(fmt.Sprintf("Decoder: openStack contains invalid byte %s", string(openCh))) + panic(fmt.Sprintf("Decoder: openStack contains invalid byte %c", openCh)) } func (d *Decoder) pushOpenStack(ch byte) { diff --git a/testing/prototest/message.go b/testing/prototest/message.go index e495628d1..c104605fa 100644 --- a/testing/prototest/message.go +++ b/testing/prototest/message.go @@ -643,7 +643,7 @@ func formatValue(v pref.Value) string { if err != nil { return fmt.Sprintf("<%v>", err) } - return fmt.Sprintf("%v{%v}", v.Descriptor().FullName(), string(b)) + return fmt.Sprintf("%v{%s}", v.Descriptor().FullName(), b) case string: return fmt.Sprintf("%q", v) default: