Skip to content

Commit

Permalink
chore(bump): changed to version 2.8.1
Browse files Browse the repository at this point in the history
Signed-off-by: Felipe Rios <felipe.rios.silva@outlook.com>
  • Loading branch information
rios0rios0 committed Oct 2, 2023
1 parent 1fe001e commit f53cd0e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 0 additions & 15 deletions cmd/autobump/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"net/url"
"os"
"path"
"reflect"
"strings"

log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -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)
}
}
}
2 changes: 1 addition & 1 deletion cmd/autobump/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f53cd0e

Please sign in to comment.