Skip to content

Commit 0232344

Browse files
authored
fix: default config override (#719)
1 parent 2186c12 commit 0232344

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

runner/config.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,9 @@ func (c *Config) rel(path string) string {
387387
// WithArgs returns a new config with the given arguments added to the configuration.
388388
func (c *Config) WithArgs(args map[string]TomlInfo) {
389389
for _, value := range args {
390-
if value.Value != nil && *value.Value != unsetDefault {
390+
// Ignore values that match the default configuration.
391+
// This ensures user-specified configurations are not overwritten by default values.
392+
if value.Value != nil && *value.Value != value.fieldValue {
391393
v := reflect.ValueOf(c)
392394
setValue2Struct(v, value.fieldPath, *value.Value)
393395
}

runner/flag.go

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import (
44
"flag"
55
)
66

7-
const unsetDefault = "DEFAULT"
8-
97
// ParseConfigFlag parse toml information for flag
108
func ParseConfigFlag(f *flag.FlagSet) map[string]TomlInfo {
119
c := defaultConfig()

0 commit comments

Comments
 (0)