mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 00:43:20 +01:00
27 lines
416 B
Go
27 lines
416 B
Go
package cyclonedx12xml
|
|
|
|
import (
|
|
"encoding/xml"
|
|
"io"
|
|
|
|
"github.com/anchore/syft/syft/sbom"
|
|
)
|
|
|
|
func encoder(output io.Writer, s sbom.SBOM, _ interface{}) error {
|
|
enc := xml.NewEncoder(output)
|
|
enc.Indent("", " ")
|
|
|
|
_, err := output.Write([]byte(xml.Header))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = enc.Encode(toFormatModel(s))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
_, err = output.Write([]byte("\n"))
|
|
return err
|
|
}
|