Go中的深度合并订单图

I am reading two YAML files, one is considered the "base" and one the "environment". I need to unmarshal them as ordered maps and merge them, retaining the order.

So if baseline looks like this:

key1: baseline
key2:
  subkey1: baseline
  subkey2:
    subsubkey1: baseline

And the environment looks like this:

key2:
  subkey2:
    subsubkey1: environment

I want the resultant map to look like this

key1: baseline
key2:
  subkey1: baseline
  subkey2:
    subsubkey1: environment

I have tried to use yaml.MapSlice{} but it is essentially an array of arrays and you cannot really merge that.

With Ruby I can use activesupport's deep_merge() and get the desired result and get similar using Python's Collections.OrderedDict. Finding anything in Go has been difficult. I get people dismissing it by saying Go is designed this way.

That's all well and good, but I need the functionality for my project.

All right, I solved it! My goal was to deep merge two yaml files and retain their order. A co-worker and I figured it out. I will be doing the same thing with the OrderedMap Python clone.