mirror of
https://github.com/anchore/grype
synced 2024-11-10 06:34:13 +00:00
9050883715
* feat(outputs): allow to set multiple outputs (#648) Signed-off-by: Olivier Boudet <o.boudet@gmail.com> Signed-off-by: Olivier Boudet <olivier.boudet@cooperl.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * feat(outputs): allow to set multiple outputs (#648) review Signed-off-by: Olivier Boudet <olivier.boudet@cooperl.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * use syft format writter pattern and de-emphasize presenter package Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Olivier Boudet <o.boudet@gmail.com> Signed-off-by: Olivier Boudet <olivier.boudet@cooperl.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
16 lines
354 B
Go
16 lines
354 B
Go
package stringutil
|
|
|
|
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()
|
|
}
|