mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
25 lines
531 B
Go
25 lines
531 B
Go
package spdx22json
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"io"
|
|
|
|
"github.com/anchore/syft/internal/formats/spdx22json/model"
|
|
"github.com/anchore/syft/syft/distro"
|
|
"github.com/anchore/syft/syft/pkg"
|
|
"github.com/anchore/syft/syft/source"
|
|
)
|
|
|
|
func decoder(reader io.Reader) (*pkg.Catalog, *source.Metadata, *distro.Distro, error) {
|
|
dec := json.NewDecoder(reader)
|
|
|
|
var doc model.Document
|
|
err := dec.Decode(&doc)
|
|
if err != nil {
|
|
return nil, nil, nil, fmt.Errorf("unable to decode spdx-json: %w", err)
|
|
}
|
|
|
|
return toSyftModel(doc)
|
|
}
|