github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/syft/formats/github/format.go (about) 1 package github 2 3 import ( 4 "encoding/json" 5 "io" 6 7 "github.com/anchore/syft/syft/sbom" 8 ) 9 10 const ID sbom.FormatID = "github-json" 11 12 func Format() sbom.Format { 13 return sbom.NewFormat( 14 sbom.AnyVersion, 15 func(writer io.Writer, sbom sbom.SBOM) error { 16 bom := toGithubModel(&sbom) 17 18 encoder := json.NewEncoder(writer) 19 encoder.SetEscapeHTML(false) 20 encoder.SetIndent("", " ") 21 22 return encoder.Encode(bom) 23 }, 24 nil, 25 nil, 26 ID, "github", 27 ) 28 }