From 1e410856af2d4297d532fe5a49f042da6751ee7b Mon Sep 17 00:00:00 2001 From: Jan Heuermann Date: Sat, 17 Aug 2024 13:45:17 +0200 Subject: [PATCH] Sort warn flags alphabetically --- klog/app/config.go | 2 ++ klog/app/config_test.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/klog/app/config.go b/klog/app/config.go index 95fa417..74fc70e 100644 --- a/klog/app/config.go +++ b/klog/app/config.go @@ -2,6 +2,7 @@ package app import ( "errors" + "sort" "strings" "github.com/jotaen/genie" @@ -349,6 +350,7 @@ var CONFIG_FILE_ENTRIES = []ConfigFileEntries[any]{ keys = append(keys, k) } } + sort.Strings(keys) result = strings.Join(keys, ", ") }) return result, c.NoWarnings.origin diff --git a/klog/app/config_test.go b/klog/app/config_test.go index 0e3b616..571c27c 100644 --- a/klog/app/config_test.go +++ b/klog/app/config_test.go @@ -214,7 +214,7 @@ func TestNoWarningsParamFromConfigFile(t *testing.T) { dc["MORE_THAN_24H"] = true return dc }()}, - // Multiple values + // Multiple values (sorted alphabetically) {`no_warnings = MORE_THAN_24H, OVERLAPPING_RANGES`, func() service.DisabledCheckers { dc := service.NewDisabledCheckers() dc["MORE_THAN_24H"] = true @@ -266,7 +266,7 @@ default_rounding = 15m default_should_total = 8h! date_format = YYYY-MM-DD time_convention = 24h -no_warnings = OVERLAPPING_RANGES, MORE_THAN_24H +no_warnings = MORE_THAN_24H, OVERLAPPING_RANGES `} { cfg, _ := NewConfig( FromDeterminedValues{NumCpus: 1},