mirror of
https://github.com/rancher/rke.git
synced 2025-05-12 18:38:11 +00:00
16 lines
333 B
Go
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
|
|
}
|