refactor(config): use maps.Copy in mergeConfigMaps

Replace the hand-rolled nested-loop map merge with the stdlib
maps.Copy. Rename the variadic parameter to configMaps so it no
longer shadows the maps package.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
This commit is contained in:
Luca Di Maio
2026-07-24 10:03:53 +02:00
parent 7ae4ba57e6
commit a6d21e1ecc
+4 -5
View File
@@ -2,6 +2,7 @@ package config
import (
"fmt"
"maps"
"os"
"path/filepath"
"strings"
@@ -151,12 +152,10 @@ func getConfigFilePaths() ([]string, error) {
}, nil
}
func mergeConfigMaps(maps ...map[string]string) map[string]string {
func mergeConfigMaps(configMaps ...map[string]string) map[string]string {
merged := make(map[string]string)
for _, m := range maps {
for k, v := range m {
merged[k] = v
}
for _, m := range configMaps {
maps.Copy(merged, m)
}
return merged
}