templateUtil.go 289 Bytes
Newer Older
Eric Myhre's avatar
Eric Myhre committed
1 2 3 4 5 6 7 8 9 10
package gengo

import (
	"io"
	"text/template"

	wish "github.com/warpfork/go-wish"
)

func doTemplate(tmplstr string, w io.Writer, data interface{}) {
11 12
	tmpl := template.Must(template.New("").
		Parse(wish.Dedent(tmplstr)))
Eric Myhre's avatar
Eric Myhre committed
13 14 15 16
	if err := tmpl.Execute(w, data); err != nil {
		panic(err)
	}
}