From 97c7e0e0ad1be5c4d211e0182ff970a2086e7679 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philip=20B=C3=B8rgesen?= Date: Tue, 21 Aug 2018 00:52:46 +0000 Subject: [PATCH] encoding/json: eliminate superfluous space in Decoder.Token error messages MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The existing Decoder.tokenError implementation creates its error messages by concatenating "invalid character " + quoteChar(c) + " " + context. All context values however already start with a space leading to error messages containing two spaces. This change removes " " from the concatenation expression. Fixes #26587 Change-Id: I93d14319396636b2a40d55053bda88c98e94a81a GitHub-Last-Rev: 6db7e1991b15beee601f558be72a2737070d8f68 GitHub-Pull-Request: golang/go#26588 Reviewed-on: https://go-review.googlesource.com/125775 Reviewed-by: Brad Fitzpatrick Reviewed-by: Daniel Martí Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/encoding/json/stream.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/encoding/json/stream.go b/src/encoding/json/stream.go index 75a4270df7..63aa030955 100644 --- a/src/encoding/json/stream.go +++ b/src/encoding/json/stream.go @@ -471,7 +471,7 @@ func (dec *Decoder) tokenError(c byte) (Token, error) { case tokenObjectComma: context = " after object key:value pair" } - return nil, &SyntaxError{"invalid character " + quoteChar(c) + " " + context, dec.offset()} + return nil, &SyntaxError{"invalid character " + quoteChar(c) + context, dec.offset()} } // More reports whether there is another element in the -- 2.50.0