From f078e5b3687d9b06bf43dd3b48d12846a4dcc4b2 Mon Sep 17 00:00:00 2001 From: Rodrigo V Honorato Date: Mon, 2 Oct 2023 12:43:37 +0200 Subject: [PATCH] improve LoadHaddock3Params --- input/input.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/input/input.go b/input/input.go index e8980c1..70a88c4 100644 --- a/input/input.go +++ b/input/input.go @@ -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)) + } + } + } } }