-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle slice with one member correctly.
- Loading branch information
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,7 +249,10 @@ func checkAllTags(mv interface{}, val reflect.Value, s *[]string, key string) { | |
sval := reflect.New(tval) | ||
slice, ok := mv.([]interface{}) | ||
if !ok { | ||
*s = append(*s, key) | ||
// See if there's a singleton, not a slice, in XML object. | ||
// If it's not there, this call will put it there. | ||
// Thanks to: zhengfang.sun <[email protected]>, | ||
checkAllTags(mv, sval, s, key) | ||
return | ||
} | ||
// 2.1. Check members of XML data | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters