From da57a9d313f4f1c0f249ee1fac5bcee091746fa6 Mon Sep 17 00:00:00 2001 From: Nemanja Milicevic Date: Mon, 16 Dec 2024 23:12:49 +0100 Subject: [PATCH] fix: default config override --- runner/config.go | 4 +++- runner/flag.go | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runner/config.go b/runner/config.go index de251c8c..681be82d 100644 --- a/runner/config.go +++ b/runner/config.go @@ -387,7 +387,9 @@ func (c *Config) rel(path string) string { // WithArgs returns a new config with the given arguments added to the configuration. func (c *Config) WithArgs(args map[string]TomlInfo) { for _, value := range args { - if value.Value != nil && *value.Value != unsetDefault { + // Ignore values that match the default configuration. + // This ensures user-specified configurations are not overwritten by default values. + if value.Value != nil && *value.Value != value.fieldValue { v := reflect.ValueOf(c) setValue2Struct(v, value.fieldPath, *value.Value) } diff --git a/runner/flag.go b/runner/flag.go index 44c568b2..1844ce27 100644 --- a/runner/flag.go +++ b/runner/flag.go @@ -4,8 +4,6 @@ import ( "flag" ) -const unsetDefault = "DEFAULT" - // ParseConfigFlag parse toml information for flag func ParseConfigFlag(f *flag.FlagSet) map[string]TomlInfo { c := defaultConfig()