MCPcopy
hub / github.com/spf13/viper / mergeFlatMap

Method mergeFlatMap

viper.go:1947–1965  ·  view source on GitHub ↗

mergeFlatMap merges the given maps, excluding values of the second map shadowed by values from the first map.

(shadow map[string]bool, m map[string]any)

Source from the content-addressed store, hash-verified

1945// mergeFlatMap merges the given maps, excluding values of the second map
1946// shadowed by values from the first map.
1947func (v *Viper) mergeFlatMap(shadow map[string]bool, m map[string]any) map[string]bool {
1948 // scan keys
1949outer:
1950 for k := range m {
1951 path := strings.Split(k, v.keyDelim)
1952 // scan intermediate paths
1953 var parentKey string
1954 for i := 1; i < len(path); i++ {
1955 parentKey = strings.Join(path[0:i], v.keyDelim)
1956 if shadow[parentKey] {
1957 // path is shadowed, continue
1958 continue outer
1959 }
1960 }
1961 // add key
1962 shadow[strings.ToLower(k)] = true
1963 }
1964 return shadow
1965}
1966
1967// AllSettings merges all settings and returns them as a map[string]any.
1968func AllSettings() map[string]any { return v.AllSettings() }

Callers 1

AllKeysMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected