Skip to content

Commit

Permalink
refactor: remove unnecessary allocation (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajatprabha authored Feb 9, 2024
1 parent 84a0872 commit 6758dd8
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions xload/providers/viper/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,8 @@ func def() *options {
ext: "yaml",
paths: []string{"./", "../"},
},
autoEnv: true,
mapValues: func(in map[string]any) map[string]string {
out := make(map[string]string)

for key, value := range xload.FlattenMap(in, "_") {
out[key] = value
}

return out
},
autoEnv: true,
mapValues: func(in map[string]any) map[string]string { return xload.FlattenMap(in, "_") },
transform: func(_ *viper.Viper, next xload.Loader) xload.Loader {
return xload.LoaderFunc(func(ctx context.Context, key string) (string, error) {
return next.Load(ctx, strings.ToLower(key))
Expand Down

0 comments on commit 6758dd8

Please sign in to comment.