fix: hydrate pointer fields
It is a mystery how this has been a bug for so long.
This commit is contained in:
@@ -320,6 +320,9 @@ func (v *Value) IsCounter() bool {
|
||||
|
||||
// Parse tokens into value, parse, and validate, but do not write to the field.
|
||||
func (v *Value) Parse(scan *Scanner, target reflect.Value) (err error) {
|
||||
if target.Kind() == reflect.Ptr && target.IsNil() {
|
||||
target.Set(reflect.New(target.Type().Elem()))
|
||||
}
|
||||
err = v.Mapper.Decode(&DecodeContext{Value: v, Scan: scan}, target)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, v.ShortSummary())
|
||||
|
||||
Reference in New Issue
Block a user