From f53cd0ee829ad0a97999d2048eaaa4a39788675d Mon Sep 17 00:00:00 2001 From: Felipe Rios Date: Sun, 1 Oct 2023 21:03:17 -0400 Subject: [PATCH] chore(bump): changed to version 2.8.1 Signed-off-by: Felipe Rios --- CHANGELOG.md | 6 ++++++ cmd/autobump/config.go | 15 --------------- cmd/autobump/main.go | 2 +- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52c4a03..fd52fa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,12 @@ Exceptions are acceptable depending on the circumstances (critical bug fixes tha - +## [2.8.1] - 2023-10-01 + +### Changed + +- corrected the configuration merging without the `reflect` library + ## [2.8.0] - 2023-10-01 ### Added diff --git a/cmd/autobump/config.go b/cmd/autobump/config.go index 215dd16..14a3b09 100644 --- a/cmd/autobump/config.go +++ b/cmd/autobump/config.go @@ -6,7 +6,6 @@ import ( "net/url" "os" "path" - "reflect" "strings" log "github.com/sirupsen/logrus" @@ -204,17 +203,3 @@ func findConfig() (string, error) { return location, nil } - -// mergeConfig merges the default config with the global config overriding the default values -func mergeConfig(customConfig, defaultConfig *GlobalConfig) { - customValue := reflect.ValueOf(customConfig).Elem() - defaultValue := reflect.ValueOf(defaultConfig).Elem() - - for i := 0; i < customValue.NumField(); i++ { - globalField := customValue.Field(i) - defaultField := defaultValue.Field(i) - if !defaultField.IsZero() { - globalField.Set(defaultField) - } - } -} diff --git a/cmd/autobump/main.go b/cmd/autobump/main.go index 56f18ae..4a1fcd3 100644 --- a/cmd/autobump/main.go +++ b/cmd/autobump/main.go @@ -85,7 +85,7 @@ func findReadAndValidateConfig(configPath string) *GlobalConfig { var defaultConfig *GlobalConfig defaultConfig, err = decodeConfig(data) - mergeConfig(globalConfig, defaultConfig) + globalConfig.LanguagesConfig = defaultConfig.LanguagesConfig } else { log.Fatalf("Config validation failed: %v", err) os.Exit(1)