spdxlib

package
v0.5.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2024 License: Apache-2.0, GPL-2.0, CC-BY-4.0 Imports: 4 Imported by: 6

Documentation

Overview

Package spdxlib contains convenience and utility functions for working with an SPDX document that has already been created in memory. SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later

SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterRelationships added in v0.5.0

func FilterRelationships(doc *spdx.Document, filter func(*spdx.Relationship) *common.ElementID) ([]common.ElementID, error)

FilterRelationships returns a slice of Element IDs returned by the given filter closure. The closure is passed one relationship at a time, and it can return an ElementID or nil.

func GetDescribedPackageIDs added in v0.5.0

func GetDescribedPackageIDs(doc *spdx.Document) ([]common.ElementID, error)

GetDescribedPackageIDs returns a slice of ElementIDs for all Packages in this Document that it "describes," according to SPDX rules:

  • If the document has only one Package, its ID is returned.
  • If the document has 2+ Packages, it returns the IDs of those that have a DESCRIBES (or DESCRIBED_BY) relationship to this DOCUMENT.

func SortElementIDs

func SortElementIDs(eIDs []common.ElementID) []common.ElementID

SortElementIDs sorts and returns the given slice of ElementIDs

func ValidateDocument added in v0.5.0

func ValidateDocument(doc *spdx.Document) error

ValidateDocument returns an error if the Document is found to be invalid, or nil if the Document is valid. Currently, this only verifies that all Element IDs mentioned in Relationships exist in the Document as either a Package or an UnpackagedFile.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL