goccy / go-yaml

YAML support for the Go language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Is it possible to merge 2 yamls preserving anchors?

rjshrjndrn opened this issue · comments

Hi,

First of all, thank you for this amazing library. I'm checking a way to merge 2 yamls, and keep the anchors intact. Is there any way to do that. Sorry for this stupid question. I'm a noob in golang.

Thank you

yaml1

people: &people
  - name: john
    age: 10
class:
  students: *people

yaml2

people:
  - name: alice
    age: 11

output.yaml

people: &people
  - name: john
    age: 10
  - name: alice
    age: 11
class:
  students: *people