dex/vendor/sigs.k8s.io/testing_frameworks/integration/internal/arguments.go
2020-01-31 10:32:00 +01:00

28 lines
447 B
Go

package internal
import (
"bytes"
"html/template"
)
func RenderTemplates(argTemplates []string, data interface{}) (args []string, err error) {
var t *template.Template
for _, arg := range argTemplates {
t, err = template.New(arg).Parse(arg)
if err != nil {
args = nil
return
}
buf := &bytes.Buffer{}
err = t.Execute(buf, data)
if err != nil {
args = nil
return
}
args = append(args, buf.String())
}
return
}