mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
19 lines
405 B
Go
19 lines
405 B
Go
package cyclonedxxml
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/CycloneDX/cyclonedx-go"
|
|
"github.com/anchore/syft/internal/formats/common/cyclonedxhelpers"
|
|
"github.com/anchore/syft/syft/sbom"
|
|
)
|
|
|
|
func encoder(output io.Writer, s sbom.SBOM) error {
|
|
bom := cyclonedxhelpers.ToFormatModel(s)
|
|
enc := cyclonedx.NewBOMEncoder(output, cyclonedx.BOMFileFormatXML)
|
|
enc.SetPretty(true)
|
|
|
|
err := enc.Encode(bom)
|
|
return err
|
|
}
|