aboutsummaryrefslogtreecommitdiff
path: root/spdxlib/documents.go
diff options
context:
space:
mode:
authorBrandon Lum <lumjjb@gmail.com>2022-07-19 16:43:48 -0400
committerBrandon Lum <lumjjb@gmail.com>2022-07-19 22:43:24 -0400
commit9ae1bd2f8e0dabb0845f1225b54f23e8f3a429f1 (patch)
treea43213aadfb9bde3d9ec15634a39305f19ff38b2 /spdxlib/documents.go
parent41d2272711255f5a25e16e3507ec3318bc550189 (diff)
downloadspdx-tools-9ae1bd2f8e0dabb0845f1225b54f23e8f3a429f1.tar.gz
replace all v2_1, v2_2 with new convention
Signed-off-by: Brandon Lum <lumjjb@gmail.com>
Diffstat (limited to 'spdxlib/documents.go')
-rw-r--r--spdxlib/documents.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/spdxlib/documents.go b/spdxlib/documents.go
index 1f7122a..8560f08 100644
--- a/spdxlib/documents.go
+++ b/spdxlib/documents.go
@@ -3,15 +3,18 @@ package spdxlib
import (
"fmt"
- "github.com/spdx/tools-golang/spdx"
+
+ "github.com/spdx/tools-golang/spdx/common"
+ "github.com/spdx/tools-golang/spdx/v2_1"
+ "github.com/spdx/tools-golang/spdx/v2_2"
)
// ValidateDocument2_1 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.
-func ValidateDocument2_1(doc *spdx.Document2_1) error {
+func ValidateDocument2_1(doc *v2_1.Document) error {
// cache a map of valid package IDs for quick lookups
- validElementIDs := make(map[spdx.ElementID]bool)
+ validElementIDs := make(map[common.ElementID]bool)
for _, docPackage := range doc.Packages {
validElementIDs[docPackage.PackageSPDXIdentifier] = true
}
@@ -21,7 +24,7 @@ func ValidateDocument2_1(doc *spdx.Document2_1) error {
}
// add the Document element ID
- validElementIDs[spdx.MakeDocElementID("", "DOCUMENT").ElementRefID] = true
+ validElementIDs[common.MakeDocElementID("", "DOCUMENT").ElementRefID] = true
for _, relationship := range doc.Relationships {
if !validElementIDs[relationship.RefA.ElementRefID] {
@@ -39,9 +42,9 @@ func ValidateDocument2_1(doc *spdx.Document2_1) error {
// ValidateDocument2_2 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.
-func ValidateDocument2_2(doc *spdx.Document2_2) error {
+func ValidateDocument2_2(doc *v2_2.Document) error {
// cache a map of package IDs for quick lookups
- validElementIDs := make(map[spdx.ElementID]bool)
+ validElementIDs := make(map[common.ElementID]bool)
for _, docPackage := range doc.Packages {
validElementIDs[docPackage.PackageSPDXIdentifier] = true
}
@@ -51,7 +54,7 @@ func ValidateDocument2_2(doc *spdx.Document2_2) error {
}
// add the Document element ID
- validElementIDs[spdx.MakeDocElementID("", "DOCUMENT").ElementRefID] = true
+ validElementIDs[common.MakeDocElementID("", "DOCUMENT").ElementRefID] = true
for _, relationship := range doc.Relationships {
if !validElementIDs[relationship.RefA.ElementRefID] {