1
0
mirror of https://github.com/rancher/rke.git synced 2025-06-27 15:59:37 +00:00
rke/templates/templates.go

16 lines
333 B
Go
Raw Normal View History

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
}