diff options
author | specter25 <ujjwalcoding012@gmail.com> | 2021-06-22 11:00:29 +0530 |
---|---|---|
committer | specter25 <ujjwalcoding012@gmail.com> | 2021-06-22 11:00:29 +0530 |
commit | 711270d8af8c313a2e9907a9e09d68fd1d9a9fb3 (patch) | |
tree | 5afc6f1cad6b4eac5c08529d96b67d6031c6318f /examples | |
parent | 7469b10714bead73885c8155ca59240a58a0aea7 (diff) | |
download | spdx-tools-711270d8af8c313a2e9907a9e09d68fd1d9a9fb3.tar.gz |
bugfix : make required changes to jsonloader example due to reorganized folder structure
Signed-off-by: specter25 <ujjwalcoding012@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/8-jsonloader/examplejsontotv.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/8-jsonloader/examplejsontotv.go b/examples/8-jsonloader/examplejsontotv.go index 7bd8e0e..ede044e 100644 --- a/examples/8-jsonloader/examplejsontotv.go +++ b/examples/8-jsonloader/examplejsontotv.go @@ -9,11 +9,9 @@ package main import ( "fmt" - "io/ioutil" - "log" "os" - "github.com/spdx/tools-golang/jsonloader2v2" + "github.com/spdx/tools-golang/jsonloader" "github.com/spdx/tools-golang/tvsaver" ) @@ -29,13 +27,16 @@ func main() { } // open the SPDX file - jsonData, err := ioutil.ReadFile(args[1]) // jsondata has type []byte + fileIn := args[1] + r, err := os.Open(fileIn) if err != nil { - log.Fatal(err) + fmt.Printf("Error while opening %v for reading: %v", fileIn, err) + return } + defer r.Close() // try to load the SPDX file's contents as a json file, version 2.2 - doc, err := jsonloader2v2.Load2_2(jsonData) + doc, err := jsonloader.Load2_2(r) if err != nil { fmt.Printf("Error while parsing %v: %v", args[1], err) return |