Skip to content

Commit

Permalink
improve LoadHaddock3Params
Browse files Browse the repository at this point in the history
  • Loading branch information
rvhonorato committed Oct 2, 2023
1 parent 01d6434 commit f078e5b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions input/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,16 @@ func LoadHaddock3Params(p string) (ModuleParams, error) {

// Add the data to the correct module
v := reflect.ValueOf(&m).Elem()
if v.FieldByName(name).IsValid() {
v.FieldByName(name).Set(reflect.ValueOf(data))
for i := 0; i < v.NumField(); i++ {
field := v.Field(i)
fieldName := v.Type().Field(i).Name
if strings.Contains(strings.ToLower(fieldName), strings.ToLower(name)) {
if field.IsValid() {
if field.CanSet() {
field.Set(reflect.ValueOf(data))
}
}
}
}

}
Expand Down

0 comments on commit f078e5b

Please sign in to comment.