aboutsummaryrefslogtreecommitdiff
path: root/tvsaver/saver2v2/save_relationship.go
blob: cff5a4a299dc9b2c10c173c483d58b074de2e4ff (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 saver2v2

import (
	"fmt"
	"io"

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

func renderRelationship2_2(rln *spdx.Relationship2_2, w io.Writer) error {
	rlnAStr := spdx.RenderDocElementID(rln.RefA)
	rlnBStr := spdx.RenderDocElementID(rln.RefB)
	if rlnAStr != "SPDXRef-" && rlnBStr != "SPDXRef-" && rln.Relationship != "" {
		fmt.Fprintf(w, "Relationship: %s %s %s\n", rlnAStr, rln.Relationship, rlnBStr)
	}
	if rln.RelationshipComment != "" {
		fmt.Fprintf(w, "RelationshipComment: %s\n", rln.RelationshipComment)
	}

	return nil
}