From fabcaa8df3d6eb852b87821ef090d31d222870b7 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 21 Nov 2012 07:03:38 +0000 Subject: libgo: Update to current version of master library. From-SVN: r193688 --- libgo/go/encoding/json/decode.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'libgo/go/encoding/json/decode.go') diff --git a/libgo/go/encoding/json/decode.go b/libgo/go/encoding/json/decode.go index 47e3d89..1e0c8d4 100644 --- a/libgo/go/encoding/json/decode.go +++ b/libgo/go/encoding/json/decode.go @@ -67,8 +67,8 @@ func Unmarshal(data []byte, v interface{}) error { // Unmarshaler is the interface implemented by objects // that can unmarshal a JSON description of themselves. -// The input can be assumed to be a valid JSON object -// encoding. UnmarshalJSON must copy the JSON data +// The input can be assumed to be a valid encoding of +// a JSON value. UnmarshalJSON must copy the JSON data // if it wishes to retain the data after returning. type Unmarshaler interface { UnmarshalJSON([]byte) error @@ -617,12 +617,10 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool switch c := item[0]; c { case 'n': // null switch v.Kind() { - default: - d.saveError(&UnmarshalTypeError{"null", v.Type()}) case reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: v.Set(reflect.Zero(v.Type())) + // otherwise, ignore null for primitives/string } - case 't', 'f': // true, false value := c == 't' switch v.Kind() { -- cgit v1.1