String converts a template to a string
(tmpl string, data any, opts ...Opt)
| 75 | |
| 76 | // String converts a template to a string |
| 77 | func String(tmpl string, data any, opts ...Opt) (string, error) { |
| 78 | var sb strings.Builder |
| 79 | err := Writer(&sb, tmpl, data) |
| 80 | if err != nil { |
| 81 | return "", err |
| 82 | } |
| 83 | return sb.String(), nil |
| 84 | } |
| 85 | |
| 86 | // WithFuncs includes additional template functions |
| 87 | func WithFuncs(funcs gotemplate.FuncMap) Opt { |
no test coverage detected
searching dependent graphs…