feat: SPDX 2.3 support (#1311)

This commit is contained in:
Keith Zantow
2022-11-18 08:54:39 -05:00
committed by GitHub
parent 0c4b99c1c2
commit 42cb0a47a4
71 changed files with 892 additions and 1339 deletions
+20
View File
@@ -0,0 +1,20 @@
package spdxjson
import (
"encoding/json"
"io"
"github.com/anchore/syft/syft/formats/common/spdxhelpers"
"github.com/anchore/syft/syft/sbom"
)
func encoder(output io.Writer, s sbom.SBOM) error {
doc := spdxhelpers.ToFormatModel(s)
enc := json.NewEncoder(output)
// prevent > and < from being escaped in the payload
enc.SetEscapeHTML(false)
enc.SetIndent("", " ")
return enc.Encode(doc)
}