xref: /aosp_15_r20/external/spdx-tools/tvsaver/saver2v1/save_creation_info.go (revision ba677afa8f67bb56cbc794f4d0e378e0da058e16)
1// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
2
3package saver2v1
4
5import (
6	"fmt"
7	"io"
8
9	"github.com/spdx/tools-golang/spdx/v2_1"
10)
11
12func renderCreationInfo2_1(ci *v2_1.CreationInfo, w io.Writer) error {
13	if ci.LicenseListVersion != "" {
14		fmt.Fprintf(w, "LicenseListVersion: %s\n", ci.LicenseListVersion)
15	}
16	for _, creator := range ci.Creators {
17		fmt.Fprintf(w, "Creator: %s: %s\n", creator.CreatorType, creator.Creator)
18	}
19	if ci.Created != "" {
20		fmt.Fprintf(w, "Created: %s\n", ci.Created)
21	}
22	if ci.CreatorComment != "" {
23		fmt.Fprintf(w, "CreatorComment: %s\n", textify(ci.CreatorComment))
24	}
25
26	// add blank newline b/c end of a main section
27	fmt.Fprintf(w, "\n")
28
29	return nil
30}
31