diff options
author | CatalinStratu <catalinstratu45@gmail.com> | 2022-05-05 08:53:05 +0300 |
---|---|---|
committer | CatalinStratu <catalinstratu45@gmail.com> | 2022-05-05 09:38:41 +0300 |
commit | 661532d2528a190b247913571b38ab47334b1398 (patch) | |
tree | 5ee172580403301d7e9e541c7585bc601b3ec9bf /examples/11-yamltotv/exampleyamltotv.go | |
parent | b9aecfb8165322e061a1a31260b3ef9199cbebd4 (diff) | |
download | spdx-tools-661532d2528a190b247913571b38ab47334b1398.tar.gz |
YAML and JSON documenttion fixes
Signed-off-by: CatalinStratu <catalinstratu45@gmail.com>
Diffstat (limited to 'examples/11-yamltotv/exampleyamltotv.go')
-rw-r--r-- | examples/11-yamltotv/exampleyamltotv.go | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/examples/11-yamltotv/exampleyamltotv.go b/examples/11-yamltotv/exampleyamltotv.go index 88f2885..b56a67d 100644 --- a/examples/11-yamltotv/exampleyamltotv.go +++ b/examples/11-yamltotv/exampleyamltotv.go @@ -1,6 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later -// Example for: *yaml* +// Example for: *yaml* *tvsaver* // This example demonstrates loading an SPDX tag-value file from disk into memory, // and re-saving it to a different file on disk. @@ -10,6 +10,7 @@ package main import ( "fmt" + "github.com/spdx/tools-golang/tvsaver" "github.com/spdx/tools-golang/yaml" "os" ) @@ -20,7 +21,7 @@ func main() { args := os.Args if len(args) != 3 { fmt.Printf("Usage: %v <yaml-file-in> <spdx-file-out>\n", args[0]) - fmt.Printf(" Load SPDX 2.2 tag-value file <yaml-file-in>, and\n") + fmt.Printf(" Load YAML file <yaml-file-in>, and\n") fmt.Printf(" save it out to <spdx-file-out>.\n") return } @@ -34,7 +35,7 @@ func main() { } defer r.Close() - // try to load the SPDX file's contents as a yaml file, version 2.2 + // try to load the SPDX file's contents as a YAML file doc, err := spdx_yaml.Load2_2(r) if err != nil { fmt.Printf("Error while parsing %v: %v", fileIn, err) @@ -56,18 +57,12 @@ func main() { defer w.Close() // try to save the document to disk as an SPDX tag-value file, version 2.2 - err = spdx_yaml.Save2_2(doc, w) + err = tvsaver.Save2_2(doc, w) if err != nil { fmt.Printf("Error while saving %v: %v", fileOut, err) return } - //err = tvsaver.Save2_2(doc, w) - //if err != nil { - // fmt.Printf("Error while saving %v: %v", fileOut, err) - // return - //} - // it worked fmt.Printf("Successfully saved %s\n", fileOut) } |