Skip to content

Commit

Permalink
fix: parse structs
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Mar 8, 2019
1 parent bb9cc66 commit 694c6bf
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions env.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,19 @@ func doParse(ref reflect.Value, funcMap CustomParsers) error {
}
continue
}
if reflect.Struct == refField.Kind() {
err := doParse(refField, funcMap)
if nil != err {
errorList = append(errorList, err.Error())
}
continue
}
refTypeField := refType.Field(i)
value, err := get(refTypeField)
if err != nil {
errorList = append(errorList, err.Error())
continue
}
if value == "" {
if reflect.Struct == refField.Kind() {
err := doParse(refField, funcMap)
if nil != err {
errorList = append(errorList, err.Error())
}
}
continue
}
if err := set(refField, refTypeField, value, funcMap); err != nil {
Expand Down

0 comments on commit 694c6bf

Please sign in to comment.