diff options
Diffstat (limited to 'src/encoding/json/v2_decode.go')
| -rw-r--r-- | src/encoding/json/v2_decode.go | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/encoding/json/v2_decode.go b/src/encoding/json/v2_decode.go index c82ee903c3..1041ec7ee4 100644 --- a/src/encoding/json/v2_decode.go +++ b/src/encoding/json/v2_decode.go @@ -117,19 +117,11 @@ type UnmarshalTypeError struct { } func (e *UnmarshalTypeError) Error() string { - s := "json: cannot unmarshal" - if e.Value != "" { - s += " JSON " + e.Value - } - s += " into" - var preposition string - if e.Field != "" { - s += " " + e.Struct + "." + e.Field - preposition = " of" - } - if e.Type != nil { - s += preposition - s += " Go type " + e.Type.String() + var s string + if e.Struct != "" || e.Field != "" { + s = "json: cannot unmarshal " + e.Value + " into Go struct field " + e.Struct + "." + e.Field + " of type " + e.Type.String() + } else { + s = "json: cannot unmarshal " + e.Value + " into Go value of type " + e.Type.String() } if e.Err != nil { s += ": " + e.Err.Error() |
