// recursively merges src into dst: // - non-pointer struct fields with any exported fields are recursively merged // - non-pointer struct fields with only unexported fields prefer src if the field is non-zero // - maps are shallow merged with src keys taking priority over dst // - non-zero src fields encountered during recursion that are not maps or structs overwrite and recursion stops func merge[T any](dst, src *T) error { … } func mergeValues(fieldNames []string, dst, src reflect.Value) error { … } // hasExportedField returns true if the given type has any exported fields, // or if it has any anonymous/embedded struct fields with exported fields func hasExportedField(dstType reflect.Type) bool { … }