syft/internal/tprint.go
anchore-oss-update-bot 5b58ec96b7
chore(deps): update Go version (#4773)
Signed-off-by: anchore-oss-update-bot <anchore-oss-update-bot@users.noreply.github.com>
Co-authored-by: anchore-oss-update-bot <anchore-oss-update-bot@users.noreply.github.com>
2026-04-15 10:01:39 -04:00

17 lines
344 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]any) string {
t := template.Must(template.New("").Parse(tmpl))
buf := &bytes.Buffer{}
if err := t.Execute(buf, data); err != nil {
return ""
}
return buf.String()
}