aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorSteve Winslow <steve@swinslow.net>2022-03-30 20:58:23 -0400
committerSteve Winslow <steve@swinslow.net>2022-03-30 20:58:23 -0400
commitdf9da3fd5daafbf22e02c6cc946242c60be55854 (patch)
tree5b41e0e2fa6c00e5bf03794ad61172f921a00469 /examples
parent7e3a22cfccbda131ebfb0d29e089a274950726ce (diff)
downloadspdx-tools-df9da3fd5daafbf22e02c6cc946242c60be55854.tar.gz
examples: Fix minor typos and wording
Signed-off-by: Steve Winslow <steve@swinslow.net>
Diffstat (limited to 'examples')
-rw-r--r--examples/10-jsonloader/example_json_loader.go18
-rw-r--r--examples/3-build/example_build.go2
-rw-r--r--examples/7-rdfloader/exampleRDFLoader.go4
-rw-r--r--examples/README.md16
4 files changed, 21 insertions, 19 deletions
diff --git a/examples/10-jsonloader/example_json_loader.go b/examples/10-jsonloader/example_json_loader.go
index c5d63b9..a9422b1 100644
--- a/examples/10-jsonloader/example_json_loader.go
+++ b/examples/10-jsonloader/example_json_loader.go
@@ -2,9 +2,9 @@
// Example for: *jsonparser2v2*
-// This example demonstrates loading an SPDX json from disk into memory,
-// and then logging out some attributes to the console .
-// Run project: go run example_json_loader.go ../sample-docs/json/SPDXJSONExample-v2.2.spdx.json example.spdx
+// This example demonstrates loading an SPDX JSON document from disk into memory,
+// and then logging some of the attributes to the console.
+// Run project: go run example_json_loader.go ../sample-docs/json/SPDXJSONExample-v2.2.spdx.json
package main
import (
@@ -19,10 +19,10 @@ func main() {
// check that we've received the right number of arguments
args := os.Args
- if len(args) != 3 {
- fmt.Printf("Usage: %v <json-file-in> <spdx-file-out>\n", args[0])
- fmt.Printf(" Load SPDX 2.2 tag-value file <spdx-file-in>, and\n")
- fmt.Printf(" save it out to <spdx-file-out>.\n")
+ if len(args) != 2 {
+ fmt.Printf("Usage: %v <json-file-in>\n", args[0])
+ fmt.Printf(" Load SPDX 2.2 JSON file <spdx-file-in>, and\n")
+ fmt.Printf(" print portions of its creation info data.\n")
return
}
@@ -49,7 +49,7 @@ func main() {
fmt.Println("Some Attributes of the Document:")
fmt.Printf("Document Name: %s\n", doc.CreationInfo.DocumentName)
fmt.Printf("DataLicense: %s\n", doc.CreationInfo.DataLicense)
- fmt.Printf("Document NameSpace: %s\n", doc.CreationInfo.DocumentNamespace)
- fmt.Printf("SPDX Document Version: %s\n", doc.CreationInfo.SPDXVersion)
+ fmt.Printf("Document Namespace: %s\n", doc.CreationInfo.DocumentNamespace)
+ fmt.Printf("SPDX Version: %s\n", doc.CreationInfo.SPDXVersion)
fmt.Println(strings.Repeat("=", 80))
}
diff --git a/examples/3-build/example_build.go b/examples/3-build/example_build.go
index 8fc6b6b..c6051cc 100644
--- a/examples/3-build/example_build.go
+++ b/examples/3-build/example_build.go
@@ -5,7 +5,7 @@
// This example demonstrates building an 'empty' SPDX document in memory that
// corresponds to a given directory's contents, including all files with their
// hashes and the package's verification code, and saving the document to disk.
-// Run project: go run example_build.go project2 ../../testdata/project2 test.spdx
+// Run project: go run example_build.go project2 ../../testdata/project2 test.spdx
package main
diff --git a/examples/7-rdfloader/exampleRDFLoader.go b/examples/7-rdfloader/exampleRDFLoader.go
index 08dc1ba..4eae8c9 100644
--- a/examples/7-rdfloader/exampleRDFLoader.go
+++ b/examples/7-rdfloader/exampleRDFLoader.go
@@ -42,7 +42,7 @@ func main() {
fmt.Println("Some Attributes of the Document:")
fmt.Printf("Document Name: %s\n", doc.CreationInfo.DocumentName)
fmt.Printf("DataLicense: %s\n", doc.CreationInfo.DataLicense)
- fmt.Printf("Document NameSpace: %s\n", doc.CreationInfo.DocumentNamespace)
- fmt.Printf("SPDX Document Version: %s\n", doc.CreationInfo.SPDXVersion)
+ fmt.Printf("Document Namespace: %s\n", doc.CreationInfo.DocumentNamespace)
+ fmt.Printf("SPDX Version: %s\n", doc.CreationInfo.SPDXVersion)
fmt.Println(strings.Repeat("=", 80))
}
diff --git a/examples/README.md b/examples/README.md
index fb201ba..dec1152 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -3,7 +3,8 @@ SPDX-License-Identifier: CC-BY-4.0
# tools-golang Examples
The `examples/` directory contains examples for how to use the various
-tools-golang sub-packages.
+tools-golang sub-packages. Sample commands below should be run from
+within the example's subdirectory.
## 1-load/
@@ -19,7 +20,8 @@ and printing some of its contents to standard output.
This example demonstrates loading an SPDX tag-value file from disk into memory,
and re-saving it to a different file on disk.
-#### Run project: *go run example_load_save.go ../sample-docs/example1/spdx/example1.spdx test.spdx*
+#### Run project: *go run example_load_save.go ../sample-docs/example1/spdx/SPDXTagExample-v2.2.spdx test.spdx*
+
## 3-build/
*builder*, *tvsaver*
@@ -27,7 +29,7 @@ and re-saving it to a different file on disk.
This example demonstrates building an 'empty' SPDX document in memory that
corresponds to a given directory's contents, including all files with their
hashes and the package's verification code, and saving the document to disk.
-#### Run project: *go run example_build.go project2 ../../testdata/project2 test.spdx*
+#### Run project: *go run example_build.go project2 ../../testdata/project2 test.spdx*
## 4-search/
@@ -46,8 +48,8 @@ Package and File license fields; and saving the resulting document to disk.
This example demonstrates loading an SPDX tag-value file from disk into memory,
generating a basic report listing counts of the concluded licenses for its
files, and printing the report to standard output.
-#### Run project: * go run example_report.go ../sample-docs/example1/spdx/SPDXTagExample-v2.2.spdx
-*
+#### Run project: *go run example_report.go ../sample-docs/example1/spdx/SPDXTagExample-v2.2.spdx*
+
## 6-licensediff
*licensediff*, *tvloader*
@@ -59,7 +61,7 @@ with matching IDs in each document.
This is generally only useful when run with two SPDX documents that describe
licenses for subsequent versions of the same set of files, AND if they have
the same identifier in both documents.
-#### Run project *Run project: go run example_licensediff.go ../sample-docs/example1/spdx/SPDXTagExample-v2.2.spdx ../sample-docs/example2/spdx/SPDXTagExample2-v2.2.spdx*
+#### Run project: *go run example_licensediff.go ../sample-docs/example1/spdx/SPDXTagExample-v2.2.spdx ../sample-docs/example2/spdx/SPDXTagExample2-v2.2.spdx*
## 7-rdfloader
@@ -91,4 +93,4 @@ and then re-saving it to a different file on disk in json format.
This example demonstrates loading an SPDX json from disk into memory
and then logging some of the attributes to the console.
-#### Run project: *go run example_json_loader.go ../sample-docs/json/SPDXJSONExample-v2.2.spdx.json example.spdx* \ No newline at end of file
+#### Run project: *go run example_json_loader.go ../sample-docs/json/SPDXJSONExample-v2.2.spdx.json*