- Module github.com/eslider/go-config with env/yaml/json/ini packages - internal: source, keymap, merge, structconv, bytesutil - cmd/envc: convert, get, merge - docs/asr ASR-0001..0008, README/CHANGELOG/AGENTS refresh - golangci-lint v2 config; tests + fixtures Co-authored-by: Cursor <cursoragent@cursor.com>
881 B
881 B
ASR-0005: Multi-source deep-merge semantics
Context
Layered configuration (defaults file < local overrides < process environment) requires predictable composition rules.
Decision
- Sources are applied in option order (left → right). Each source parses to a
map[string]any, thenmerge.DeepMergefolds them. - Maps recurse — nested keys are unioned; existing nested maps are not replaced wholesale by a sibling scalar.
- Scalar leaves use last-write-wins (later source wins).
- Slices default to
merge.Replace;WithSliceMerge(merge.Concat)appends prior and new slice elements.
Consequences
- Env files and
WithCurrentEnvironment()compose when ordered lowest → highest priority. - Tests lock behaviour via
fixtures/merge/*.
Status
Accepted — 2026-05-02.
References
- ASR-0003
internal/merge