mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
23 lines
408 B
Go
23 lines
408 B
Go
package spdx22json
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"io"
|
|
|
|
"github.com/anchore/syft/internal/formats/spdx22json/model"
|
|
"github.com/anchore/syft/syft/sbom"
|
|
)
|
|
|
|
func decoder(reader io.Reader) (*sbom.SBOM, error) {
|
|
dec := json.NewDecoder(reader)
|
|
|
|
var doc model.Document
|
|
err := dec.Decode(&doc)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("unable to decode syft-json: %w", err)
|
|
}
|
|
|
|
return toSyftModel(doc)
|
|
}
|