Skip to content

Instantly share code, notes, and snippets.

@jonbodner
Created December 28, 2017 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonbodner/36ed810633d731bee602584e8694910b to your computer and use it in GitHub Desktop.
Save jonbodner/36ed810633d731bee602584e8694910b to your computer and use it in GitHub Desktop.
func (d *decodeState) unmarshal(v interface{}) (err error) {
<skip over some setup>
rv := reflect.ValueOf(v)
if rv.Kind() != reflect.Ptr || rv.IsNil() {
return &InvalidUnmarshalError{reflect.TypeOf(v)}
}
d.scan.reset()
// We decode rv not rv.Elem because the Unmarshaler interface
// test must be applied at the top level of the value.
d.value(rv)
return d.savedError
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment