github.com/nextlinux/gosbom@v0.81.1-0.20230627115839-1ff50c281391/gosbom/formats/spdxtagvalue/decoder.go (about)

     1  package spdxtagvalue
     2  
     3  import (
     4  	"fmt"
     5  	"io"
     6  
     7  	"github.com/nextlinux/gosbom/gosbom/formats/common/spdxhelpers"
     8  	"github.com/nextlinux/gosbom/gosbom/sbom"
     9  	"github.com/spdx/tools-golang/tagvalue"
    10  )
    11  
    12  func decoder(reader io.Reader) (*sbom.SBOM, error) {
    13  	doc, err := tagvalue.Read(reader)
    14  	if err != nil {
    15  		return nil, fmt.Errorf("unable to decode spdx-tag-value: %w", err)
    16  	}
    17  
    18  	return spdxhelpers.ToGosbomModel(doc)
    19  }