Skip to content

Commit

Permalink
Merge pull request #57 from CycloneDX/tweaks
Browse files Browse the repository at this point in the history
Tweaks
  • Loading branch information
nscuro committed Sep 28, 2022
2 parents c2db05e + 124f2be commit 39a1d8f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -30,7 +30,7 @@ Also, checkout the [`examples`](./example_test.go) to get an idea of how this li
|:---------------------:|:---------------------:|:------------------------:|
| < v0.4.0 | 1.14+ | 1.2 |
| == v0.4.0 | 1.14+ | 1.3 |
| >= v0.5.0 | 1.15+ | 1.4 |
| >= v0.5.0, < v0.7.0 | 1.15+ | 1.4 |
| >= v0.7.0 | 1.17+ | 1.0-1.4 |

We're aiming to support all [officially supported](https://golang.org/doc/devel/release.html#policy) Go versions, plus
Expand Down
2 changes: 1 addition & 1 deletion copy.go
Expand Up @@ -24,7 +24,7 @@ import (
)

// copy creates a deep copy of the BOM in a given destination.
// Copying is currently done be encoding and decoding the BOM struct using the gop.
// Copying is currently done by encoding and decoding the BOM struct using gob.
// In the future we may choose to switch to a more efficient strategy,
// and consider to export this API.
func (b BOM) copy(dst *BOM) error {
Expand Down
3 changes: 3 additions & 0 deletions cyclonedx.go
Expand Up @@ -19,6 +19,7 @@ package cyclonedx

import (
"encoding/xml"
"errors"
"fmt"
"regexp"
)
Expand All @@ -29,6 +30,8 @@ const (
BOMFormat = "CycloneDX"
)

var ErrInvalidSpecVersion = errors.New("invalid specification version")

type Advisory struct {
Title string `json:"title,omitempty" xml:"title,omitempty"`
URL string `json:"url" xml:"url"`
Expand Down
6 changes: 5 additions & 1 deletion cyclonedx_json.go
Expand Up @@ -17,7 +17,9 @@

package cyclonedx

import "encoding/json"
import (
"encoding/json"
)

func (sv SpecVersion) MarshalJSON() ([]byte, error) {
return json.Marshal(sv.String())
Expand All @@ -41,6 +43,8 @@ func (sv *SpecVersion) UnmarshalJSON(bytes []byte) error {
*sv = SpecVersion1_3
case SpecVersion1_4.String():
*sv = SpecVersion1_4
default:
return ErrInvalidSpecVersion
}

return nil
Expand Down
2 changes: 2 additions & 0 deletions cyclonedx_xml.go
Expand Up @@ -183,6 +183,8 @@ func (sv *SpecVersion) UnmarshalXML(d *xml.Decoder, start xml.StartElement) erro
*sv = SpecVersion1_3
case SpecVersion1_4.String():
*sv = SpecVersion1_4
default:
return ErrInvalidSpecVersion
}

return nil
Expand Down

0 comments on commit 39a1d8f

Please sign in to comment.