Skip to content

Commit ee1f93a

Browse files
committed
share interface and ignore PointerDecode dead code
1 parent a4dc372 commit ee1f93a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

decode.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,14 @@ func (md *MetaData) unify(data interface{}, rv reflect.Value) error {
198198
return nil
199199
}
200200

201+
rvi := rv.Interface()
201202
// Special case. Unmarshaler Interface support.
202-
if v, ok := rv.Interface().(Unmarshaler); ok {
203+
if v, ok := rvi.(Unmarshaler); ok {
203204
return v.UnmarshalTOML(data)
204205
}
205206

206207
// Special case. Look for a value satisfying the TextUnmarshaler interface.
207-
if v, ok := rv.Interface().(encoding.TextUnmarshaler); ok {
208+
if v, ok := rvi.(encoding.TextUnmarshaler); ok {
208209
return md.unifyText(data, v)
209210
}
210211
// TODO:
@@ -224,7 +225,7 @@ func (md *MetaData) unify(data interface{}, rv reflect.Value) error {
224225
switch k {
225226
case reflect.Ptr:
226227
elem := reflect.New(rv.Type().Elem())
227-
err := md.unify(data, indirect(elem))
228+
err := md.unify(data, reflect.Indirect(elem))
228229
if err != nil {
229230
return err
230231
}

0 commit comments

Comments
 (0)