mirror of
https://github.com/golang/go
synced 2024-11-23 19:30:05 -07:00
encoding/json: eliminate superfluous space in Decoder.Token error messages
The existing Decoder.tokenError implementation creates its error messages by concatenating "invalid character " + quoteChar(c) + " " + context. All context values however already starts with space leading to error messages containing two spaces. This change removes the extra space from the concatenation, reverting the prior space removal from each context.
This commit is contained in:
parent
24a77743e6
commit
6db7e1991b
@ -459,19 +459,19 @@ func (dec *Decoder) tokenError(c byte) (Token, error) {
|
||||
var context string
|
||||
switch dec.tokenState {
|
||||
case tokenTopValue:
|
||||
context = "looking for beginning of value"
|
||||
context = " looking for beginning of value"
|
||||
case tokenArrayStart, tokenArrayValue, tokenObjectValue:
|
||||
context = "looking for beginning of value"
|
||||
context = " looking for beginning of value"
|
||||
case tokenArrayComma:
|
||||
context = "after array element"
|
||||
context = " after array element"
|
||||
case tokenObjectKey:
|
||||
context = "looking for beginning of object key string"
|
||||
context = " looking for beginning of object key string"
|
||||
case tokenObjectColon:
|
||||
context = "after object key"
|
||||
context = " after object key"
|
||||
case tokenObjectComma:
|
||||
context = "after object key:value pair"
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user