feat(infra): tipos ConfigError y ConfigValidation + funciones puras Go (validate, merge, dump)
- ConfigError y ConfigValidation como tipos producto con sus .md en types/infra/ - config_validate: validacion con tags required/format/min/max/oneof via reflection - config_merge: merge no-mutante de map[string]string con precedencia de override - config_dump: serializacion de structs a map con mascara *** para campos secret - 17 tests unitarios, todos PASS Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package infra
|
||||
|
||||
// ConfigMerge merges two string maps, with override taking precedence over base.
|
||||
// Keys present in both maps take the value from override.
|
||||
// Keys present only in base are kept. Keys present only in override are added.
|
||||
// Neither input map is mutated — a new map is returned.
|
||||
func ConfigMerge(base, override map[string]string) map[string]string {
|
||||
result := make(map[string]string, len(base)+len(override))
|
||||
for k, v := range base {
|
||||
result[k] = v
|
||||
}
|
||||
for k, v := range override {
|
||||
result[k] = v
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user