Document ToYaml function

This commit is contained in:
Andrew Stuart
2016-12-09 13:21:48 -07:00
parent ec964ff41d
commit 0474bcbcf1

View File

@@ -146,6 +146,10 @@ func (f Files) AsSecrets() string {
return ToYaml(m)
}
// ToYaml takes an interface, marshals it to yaml, and returns a string. It will
// always return a string, even on marshal error (empty string).
//
// This is designed to be called from a template.
func ToYaml(v interface{}) string {
data, err := yaml.Marshal(v)
if err != nil {