mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
* fix spdx namespace and add scheme range assertions Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * validate SPDX document name from source metadata Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * comment why namespace tests only check prefix Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
23 lines
372 B
Go
23 lines
372 B
Go
package spdx22json
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io"
|
|
|
|
"github.com/anchore/syft/syft/sbom"
|
|
)
|
|
|
|
func encoder(output io.Writer, s sbom.SBOM) error {
|
|
doc, err := toFormatModel(s)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
enc := json.NewEncoder(output)
|
|
// prevent > and < from being escaped in the payload
|
|
enc.SetEscapeHTML(false)
|
|
enc.SetIndent("", " ")
|
|
|
|
return enc.Encode(doc)
|
|
}
|