How does one parse multiple yamls in a file similar to how kubectl does it?
example.yaml
---
a: Easy!
b:
c: 0
d: [1, 2]
---
a: Peasy!
b:
c: 1000
d: [3, 4]
There's a difference in behavior between gopkg.in/yaml.v2 and gopkg.in/yaml.v3:
V2: https://play.golang.org/p/XScWhdPHukO V3: https://play.golang.org/p/OfFY4qH5wW2
Both implementations produce an incorrect result IMHO but V3 is apparently slightly worse.
There's a workaround. If you slightly change code in the accepted answer, it works correctly and in the same fashion with both versions of yaml package: https://play.golang.org/p/r4ogBVcRLCb