1
0
mirror of https://github.com/rancher/rke.git synced 2025-05-12 18:38:11 +00:00
rke/templates/templates.go
2018-02-01 23:28:31 +02:00

16 lines
333 B
Go

package templates
import (
"bytes"
"text/template"
)
func CompileTemplateFromMap(tmplt string, configMap interface{}) (string, error) {
out := new(bytes.Buffer)
t := template.Must(template.New("compiled_template").Parse(tmplt))
if err := t.Execute(out, configMap); err != nil {
return "", err
}
return out.String(), nil
}