Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into feat/spdx-3-prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
kzantow committed Jan 28, 2025
2 parents 49d029d + d09396a commit 23c3aaf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@
`tools-golang` is a collection of Go packages intended to make it easier for
Go programs to work with [SPDX®](https://spdx.dev/) files.

## Recent news

2022-01-11: **v0.4.0**: added support for SPDX v2.3 and YAML, as well as other
improvements and bugfixes. See [RELEASE-NOTES.md](./RELEASE-NOTES.md) for full
details.

## What it does

tools-golang currently works with files conformant to versions 2.1 and 2.2
tools-golang currently works with files conformant to versions 2.1, 2.2 and 2.3
of the SPDX specification, available at: https://spdx.dev/specifications

tools-golang provides the following packages:
Expand Down
6 changes: 3 additions & 3 deletions spdx/v2/common/annotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ func (a *Annotator) UnmarshalJSON(data []byte) error {
annotatorStr := string(data)
annotatorStr = strings.Trim(annotatorStr, "\"")

annotatorFields := strings.SplitN(annotatorStr, ": ", 2)
annotatorFields := strings.SplitN(annotatorStr, ":", 2)

if len(annotatorFields) != 2 {
return fmt.Errorf("failed to parse Annotator '%s'", annotatorStr)
}

a.AnnotatorType = annotatorFields[0]
a.Annotator = annotatorFields[1]
a.AnnotatorType = strings.TrimSpace(annotatorFields[0])
a.Annotator = strings.TrimSpace(annotatorFields[1])

return nil
}
Expand Down
6 changes: 3 additions & 3 deletions spdx/v2/common/creation_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ type Creator struct {
func (c *Creator) UnmarshalJSON(data []byte) error {
str := string(data)
str = strings.Trim(str, "\"")
fields := strings.SplitN(str, ": ", 2)
fields := strings.SplitN(str, ":", 2)

if len(fields) != 2 {
return fmt.Errorf("failed to parse Creator '%s'", str)
}

c.CreatorType = fields[0]
c.Creator = fields[1]
c.CreatorType = strings.TrimSpace(fields[0])
c.Creator = strings.TrimSpace(fields[1])

return nil
}
Expand Down
6 changes: 3 additions & 3 deletions spdx/v2/common/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ func (s *Supplier) UnmarshalJSON(data []byte) error {
return nil
}

supplierFields := strings.SplitN(supplierStr, ": ", 2)
supplierFields := strings.SplitN(supplierStr, ":", 2)

if len(supplierFields) != 2 {
return fmt.Errorf("failed to parse Supplier '%s'", supplierStr)
}

s.SupplierType = supplierFields[0]
s.Supplier = supplierFields[1]
s.SupplierType = strings.TrimSpace(supplierFields[0])
s.Supplier = strings.TrimSpace(supplierFields[1])

return nil
}
Expand Down

0 comments on commit 23c3aaf

Please sign in to comment.