blob: 8f2b94dc60367af835ffc731478516185aa078c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
package spdx_json
import (
"encoding/json"
"github.com/spdx/tools-golang/spdx/v2_3"
"io"
"github.com/spdx/tools-golang/spdx/v2_2"
)
// Save2_2 takes an SPDX Document (version 2.2) and an io.Writer, and writes the document to the writer in JSON format.
func Save2_2(doc *v2_2.Document, w io.Writer) error {
buf, err := json.Marshal(doc)
if err != nil {
return err
}
_, err = w.Write(buf)
if err != nil {
return err
}
return nil
}
// Save2_3 takes an SPDX Document (version 2.2) and an io.Writer, and writes the document to the writer in JSON format.
func Save2_3(doc *v2_3.Document, w io.Writer) error {
buf, err := json.Marshal(doc)
if err != nil {
return err
}
_, err = w.Write(buf)
if err != nil {
return err
}
return nil
}
|