Skip to content

Commit

Permalink
process []interface{} values as well as map[string]interface{} values…
Browse files Browse the repository at this point in the history
… everywhere
  • Loading branch information
Charles Banning committed Feb 22, 2017
1 parent 42bf233 commit 44d8b9d
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions missingtags.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ func MissingXMLTags(b []byte, val interface{}) ([]string, string, error) {

vv, ok := v.(map[string]interface{})
if !ok {
// return the name of the value passed if not a map[string]interface{} value
s = append(s, reflect.ValueOf(val).Type().Name())
return s, root, nil
if _, ok = v.([]interface{}); !ok {
// return the name of the value passed if not a map[string]interface{} value
s = append(s, reflect.ValueOf(val).Type().Name())
return s, root, nil
}
}

checkMembers(vv, reflect.ValueOf(val), &s, "")
Expand All @@ -94,9 +96,11 @@ func MissingXMLTagsMap(b []byte, val interface{}) ([]string, mxj.Map, string, er

vv, ok := v.(map[string]interface{})
if !ok {
// return the name of the value passed if not a map[string]interface{} value
s = append(s, reflect.ValueOf(val).Type().Name())
return s, m, root, nil
if _, ok = v.([]interface{}); !ok {
// return the name of the value passed if not a map[string]interface{} value
s = append(s, reflect.ValueOf(val).Type().Name())
return s, m, root, nil
}
}

checkMembers(vv, reflect.ValueOf(val), &s, "")
Expand All @@ -123,9 +127,11 @@ func MissingXMLTagsReader(r io.Reader, val interface{}) ([]string, string, error

vv, ok := v.(map[string]interface{})
if !ok {
// return the name of the value passed if not a map[string]interface{} value
s = append(s, reflect.ValueOf(val).Type().Name())
return s, root, nil
if _, ok = v.([]interface{}); !ok {
// return the name of the value passed if not a map[string]interface{} value
s = append(s, reflect.ValueOf(val).Type().Name())
return s, root, nil
}
}

checkMembers(vv, reflect.ValueOf(val), &s, "")
Expand All @@ -152,9 +158,11 @@ func MissingXMLTagsReaderMap(r io.Reader, val interface{}) ([]string, mxj.Map, s

vv, ok := v.(map[string]interface{})
if !ok {
// return the name of the value passed if not a map[string]interface{} value
s = append(s, reflect.ValueOf(val).Type().Name())
return s, m, root, nil
if _, ok = v.([]interface{}); !ok {
// return the name of the value passed if not a map[string]interface{} value
s = append(s, reflect.ValueOf(val).Type().Name())
return s, m, root, nil
}
}

checkMembers(vv, reflect.ValueOf(val), &s, "")
Expand All @@ -181,9 +189,11 @@ func MissingXMLTagsReaderMapRaw(r io.Reader, val interface{}) ([]string, mxj.Map

vv, ok := v.(map[string]interface{})
if !ok {
// return the name of the value passed if not a map[string]interface{} value
s = append(s, reflect.ValueOf(val).Type().Name())
return s, m, root, raw, nil
if _, ok = v.([]interface{}); !ok {
// return the name of the value passed if not a map[string]interface{} value
s = append(s, reflect.ValueOf(val).Type().Name())
return s, m, root, raw, nil
}
}

checkMembers(vv, reflect.ValueOf(val), &s, "")
Expand Down

0 comments on commit 44d8b9d

Please sign in to comment.