json: don't indirect before testing for custom unmarshaler

Fixes #1260.

R=gri
CC=golang-dev
https://golang.org/cl/2994041
This commit is contained in:
Rob Pike 2010-11-08 15:33:00 -08:00
parent 9f19392f1a
commit e9c901dbf4
2 changed files with 25 additions and 1 deletions

View file

@ -128,7 +128,9 @@ func (d *decodeState) unmarshal(v interface{}) (err os.Error) {
}
d.scan.reset()
d.value(pv.Elem())
// We decode rv not pv.Elem because the Unmarshaler interface
// test must be applied at the top level of the value.
d.value(rv)
return d.savedError
}