I am kind of stuck here. I want to write a (generic, if possible!) function which will merge two structs of the same type - which also might contain not just primitives, but structs, and even slices.
Due to the constraints that are placed on us at the business level, we can't really use mergo, so I need to write this. But I am kind of having trouble getting any results worth talking about - I am not looking for a fully working solution (if you have code, it'll help for sure) but I really need some guidance on what this algorithm might look like.
I'd imagine I want to do something like have :
func Merge(source CustomStruct, target CustomStruct) result CustomStruct{
// Maybe some kind of son work to get my two structs to be strings?
// Iterate the JSON, comparing each field and taking values from source and target (depending on rules), and add them to result...
// recursion for when it contains another struct, or slice?
// return result
}