mirror of
https://github.com/anchore/syft
synced 2024-11-10 06:14:16 +00:00
16 lines
352 B
Go
16 lines
352 B
Go
package internal
|
|
|
|
import (
|
|
"bytes"
|
|
"text/template"
|
|
)
|
|
|
|
// Tprintf renders a string from a given template string and field values
|
|
func Tprintf(tmpl string, data map[string]interface{}) string {
|
|
t := template.Must(template.New("").Parse(tmpl))
|
|
buf := &bytes.Buffer{}
|
|
if err := t.Execute(buf, data); err != nil {
|
|
return ""
|
|
}
|
|
return buf.String()
|
|
}
|