mirror of
https://github.com/anchore/syft.git
synced 2026-10-30 22:12:28 +01:00
29 lines
453 B
Go
29 lines
453 B
Go
package github
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io"
|
|
|
|
"github.com/anchore/syft/syft/sbom"
|
|
)
|
|
|
|
const ID sbom.FormatID = "github-json"
|
|
|
|
func Format() sbom.Format {
|
|
return sbom.NewFormat(
|
|
sbom.AnyVersion,
|
|
func(writer io.Writer, sbom sbom.SBOM) error {
|
|
bom := toGithubModel(&sbom)
|
|
|
|
encoder := json.NewEncoder(writer)
|
|
encoder.SetEscapeHTML(false)
|
|
encoder.SetIndent("", " ")
|
|
|
|
return encoder.Encode(bom)
|
|
},
|
|
nil,
|
|
nil,
|
|
ID, "github",
|
|
)
|
|
}
|