mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 00:43:20 +01:00
use xml encoder (#165)
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
parent
8a4886ec0e
commit
df7c83c9b0
@ -66,16 +66,15 @@ func (pres *Presenter) Present(output io.Writer) error {
|
||||
return fmt.Errorf("unsupported source: %T", src)
|
||||
}
|
||||
|
||||
xmlOut, err := xml.MarshalIndent(bom, " ", " ")
|
||||
encoder := xml.NewEncoder(output)
|
||||
encoder.Indent("", " ")
|
||||
|
||||
_, err := output.Write([]byte(xml.Header))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = output.Write([]byte(xml.Header))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = output.Write(xmlOut)
|
||||
err = encoder.Encode(bom)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<bom xmlns="http://cyclonedx.org/schema/bom/1.2" xmlns:bd="http://cyclonedx.org/schema/ext/bom-descriptor/1.0" version="1" serialNumber="urn:uuid:88c9a559-fb74-45a1-9dbb-a3d8bcbcacc8">
|
||||
<bom xmlns="http://cyclonedx.org/schema/bom/1.2" xmlns:bd="http://cyclonedx.org/schema/ext/bom-descriptor/1.0" version="1" serialNumber="urn:uuid:b3b1786a-2de3-4501-b902-58b701b8ad0e">
|
||||
<components>
|
||||
<component type="library">
|
||||
<name>package1</name>
|
||||
@ -21,7 +21,7 @@
|
||||
</component>
|
||||
</components>
|
||||
<bd:metadata>
|
||||
<bd:timestamp>2020-08-29T20:17:49-04:00</bd:timestamp>
|
||||
<bd:timestamp>2020-08-30T21:50:50-04:00</bd:timestamp>
|
||||
<bd:tool>
|
||||
<bd:vendor>anchore</bd:vendor>
|
||||
<bd:name>syft</bd:name>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<bom xmlns="http://cyclonedx.org/schema/bom/1.2" xmlns:bd="http://cyclonedx.org/schema/ext/bom-descriptor/1.0" version="1" serialNumber="urn:uuid:6da957f1-3337-4128-870c-fe271aa195d1">
|
||||
<bom xmlns="http://cyclonedx.org/schema/bom/1.2" xmlns:bd="http://cyclonedx.org/schema/ext/bom-descriptor/1.0" version="1" serialNumber="urn:uuid:ab970429-e6a2-44a1-810c-f9ed2b7c3147">
|
||||
<components>
|
||||
<component type="library">
|
||||
<name>package1</name>
|
||||
@ -21,7 +21,7 @@
|
||||
</component>
|
||||
</components>
|
||||
<bd:metadata>
|
||||
<bd:timestamp>2020-08-29T20:17:49-04:00</bd:timestamp>
|
||||
<bd:timestamp>2020-08-30T21:50:50-04:00</bd:timestamp>
|
||||
<bd:tool>
|
||||
<bd:vendor>anchore</bd:vendor>
|
||||
<bd:name>syft</bd:name>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user