config: Merge with per-value origins; configcmd: UnknownKeysNode
config.Merge(sources...) overlays explicit, ordered sources with the LoadMerged rules (LoadMerged now uses the same code) and returns the origin of every leaf, for a "config show" that says where each value is set. config.ReadFile reads one file as a mapping, Resolver.Paths() exposes the core/paths resolver (e.g. DataDir for defaults). configcmd.UnknownKeysNode checks one section of a parsed document. Needed by the yamase family's layered configuration (yamase ADR-0074). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b7f7ba6b36
commit
185211e304
7 files changed
+262
-13
No files matched your search
+1
-13
@@ -25,19 +25,7 @@ func mergeMaps(base, over map[string]any) map[string]any {
|
||||
if base == nil {
|
||||
base = map[string]any{}
|
||||
}
|
||||
for k, v := range over {
|
||||
if v == nil {
|
||||
delete(base, k)
|
||||
continue
|
||||
}
|
||||
if overMap, ok := v.(map[string]any); ok {
|
||||
if baseMap, ok := base[k].(map[string]any); ok {
|
||||
base[k] = mergeMaps(baseMap, overMap)
|
||||
continue
|
||||
}
|
||||
}
|
||||
base[k] = v
|
||||
}
|
||||
mergeTracked(base, over, "", "", nil)
|
||||
return base
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user