mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 17:03:17 +01:00
21 lines
414 B
Go
21 lines
414 B
Go
package syftjson
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io"
|
|
|
|
"github.com/anchore/syft/syft/sbom"
|
|
)
|
|
|
|
func encoder(output io.Writer, s sbom.SBOM, appConfig interface{}) error {
|
|
// TODO: application config not available yet
|
|
doc := ToFormatModel(s, appConfig)
|
|
|
|
enc := json.NewEncoder(output)
|
|
// prevent > and < from being escaped in the payload
|
|
enc.SetEscapeHTML(false)
|
|
enc.SetIndent("", " ")
|
|
|
|
return enc.Encode(&doc)
|
|
}
|