aboutsummaryrefslogtreecommitdiff
path: root/v0/builder/builder2v1/build_relationship.go
blob: 6866d14f792eaa59da791ddae8a5b1a89f4f3021 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later

package builder2v1

import (
	"fmt"

	"github.com/spdx/tools-golang/v0/spdx"
)

// BuildRelationshipSection2_1 creates an SPDX Relationship (version 2.1)
// solely for the document "DESCRIBES" package relationship, returning that
// relationship or error if any is encountered. Arguments:
//   - packageName: name of package / directory
func BuildRelationshipSection2_1(packageName string) (*spdx.Relationship2_1, error) {
	rln := &spdx.Relationship2_1{
		RefA:         "SPDXRef-DOCUMENT",
		RefB:         fmt.Sprintf("SPDXRef-Package-%s", packageName),
		Relationship: "DESCRIBES",
	}

	return rln, nil
}