Merge pull request #104 from ferhatelmas/simplification

structs: some simplification
This commit is contained in:
Fatih Arslan 2018-01-22 14:26:37 +03:00 committed by GitHub
commit cb93195a59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -203,9 +203,7 @@ func (s *Struct) Values() []interface{} {
if IsStruct(val.Interface()) && !tagOpts.Has("omitnested") {
// look out for embedded structs, and convert them to a
// []interface{} to be added to the final values slice
for _, embeddedVal := range Values(val.Interface()) {
t = append(t, embeddedVal)
}
t = append(t, Values(val.Interface())...)
} else {
t = append(t, val.Interface())
}
@ -573,7 +571,7 @@ func (s *Struct) nested(val reflect.Value) interface{} {
break
}
slices := make([]interface{}, val.Len(), val.Len())
slices := make([]interface{}, val.Len())
for x := 0; x < val.Len(); x++ {
slices[x] = s.nested(val.Index(x))
}