unmarshal: use UnmarshalText for any type (#642)

Not only structs can implement TextUnmarshaler.

Fixes #564
This commit is contained in:
Thomas Pelletier
2021-10-28 17:02:47 -04:00
committed by GitHub
parent d0d001625c
commit c871a61015
2 changed files with 25 additions and 4 deletions
-4
View File
@@ -560,10 +560,6 @@ func (d *decoder) handleTablePart(key ast.Iterator, v reflect.Value) (reflect.Va
}
func (d *decoder) tryTextUnmarshaler(node *ast.Node, v reflect.Value) (bool, error) {
if v.Kind() != reflect.Struct {
return false, nil
}
// Special case for time, because we allow to unmarshal to it from
// different kind of AST nodes.
if v.Type() == timeType {