'generate a yaml file dynamically in golang

I want to generate a yaml file using a struct's yaml tags, but I want to ignore the omitempty tags. So I figured I should go over the struct recursively with reflection, and get the information using Tag.GetTag("yaml").
This is fine, but it leaves me with the task of creating a yaml with this information.
I started writing this -

const Indent = "  "
const NL = ":\n"

type Yaml struct {
    Simple []string
    Slices [][]Yaml
    Nested map[string] *Yaml
}

But I actually hope there is a useful library to do this, as it seems like a relatively common task to do. Unfortunately,a search in Google didn't find anything.
Does such a library exist?
Thanks,



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source