mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
* set package ID in catalogers and improve hashing performance Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update setting ID + tests Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
20 lines
333 B
Go
20 lines
333 B
Go
package syftjson
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io"
|
|
|
|
"github.com/anchore/syft/syft/sbom"
|
|
)
|
|
|
|
func encoder(output io.Writer, s sbom.SBOM) error {
|
|
doc := toFormatModel(s)
|
|
|
|
enc := json.NewEncoder(output)
|
|
// prevent > and < from being escaped in the payload
|
|
enc.SetEscapeHTML(false)
|
|
enc.SetIndent("", " ")
|
|
|
|
return enc.Encode(&doc)
|
|
}
|