1234567891011121314151617181920212223 |
- package utils
- import (
- "bytes"
- "html/template"
- )
- // HTML return an HTML template
- func HTML(filename string, params interface{}) (string, error) {
- t, err := template.ParseFiles(filename)
- if err != nil {
- return "", err
- }
- buf := new(bytes.Buffer)
- t.Execute(buf, params)
- return buf.String(), nil
- }
|