set myself as maintainer
[debian/orchestra.git] / go-patches / json-unmarshal-immediate.diff
1 diff -r bacb4ed5791c src/pkg/json/decode.go
2 --- a/src/pkg/json/decode.go    Thu Aug 04 16:38:18 2011 +1000
3 +++ b/src/pkg/json/decode.go    Mon Aug 22 16:50:36 2011 +1000
4 @@ -549,6 +549,17 @@
5         item := d.data[start:d.off]
6  
7         // Check for unmarshaler.
8 +       // first, check if we can do an immediate unmarshalling.
9 +       if v.CanAddr() {
10 +               unmarshaler, ok := v.Addr().Interface().(Unmarshaler)
11 +               if ok {
12 +                       err := unmarshaler.UnmarshalJSON(item)
13 +                       if err != nil {
14 +                               d.error(err)
15 +                       }
16 +                       return
17 +               }
18 +       }
19         wantptr := item[0] == 'n' // null
20         unmarshaler, pv := d.indirect(v, wantptr)
21         if unmarshaler != nil {