From ab5e6fe781a82c26e1575fe02c153aa2616c5c09 Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Thu, 18 Jul 2024 22:14:10 +0530 Subject: [PATCH] test failure --- cmd/util/confighelpers/configuration.go | 32 ------------------------- 1 file changed, 32 deletions(-) diff --git a/cmd/util/confighelpers/configuration.go b/cmd/util/confighelpers/configuration.go index 55c9ec330f..e9e090d038 100644 --- a/cmd/util/confighelpers/configuration.go +++ b/cmd/util/confighelpers/configuration.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "os" - "reflect" "strings" "time" @@ -248,7 +247,6 @@ func EndCommonParse(k *koanf.Koanf, config interface{}) error { // Default values DecodeHook: mapstructure.ComposeDecodeHookFunc( - stringToSliceDurationHookFunc(","), mapstructure.StringToTimeDurationHookFunc()), Metadata: nil, Result: config, @@ -262,36 +260,6 @@ func EndCommonParse(k *koanf.Koanf, config interface{}) error { return nil } -func stringToSliceDurationHookFunc(sep string) mapstructure.DecodeHookFunc { - return func( - f reflect.Type, - t reflect.Type, - data interface{}) (interface{}, error) { - if f.Kind() != reflect.String { - return data, nil - } - if t != reflect.TypeOf([]time.Duration{}) { - return data, nil - } - - raw, _ := data.(string) - if raw == "" { - return []time.Duration{}, nil - } - // raw[1:len(raw)-1] removes the '[' , ']' around the string - durationStrings := strings.Split(raw[1:len(raw)-1], sep) - var durations []time.Duration - for _, durationString := range durationStrings { - duration, err := time.ParseDuration(durationString) - if err != nil { - return nil, err - } - durations = append(durations, duration) - } - return durations, nil - } -} - func DumpConfig(k *koanf.Koanf, extraOverrideFields map[string]interface{}) error { overrideFields := map[string]interface{}{"conf.dump": false}