Skip to content

Commit 7a86f94

Browse files
authored
chore: Remove dependency on github.com/pkg/errors (#1233)
This can be handled by the stdlib fmt package. Signed-off-by: James Alseth <james@jalseth.me>
1 parent e1ed969 commit 7a86f94

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ require (
2424
github.com/open-policy-agent/opa v1.11.0
2525
github.com/opencontainers/image-spec v1.1.1
2626
github.com/owenrumney/go-sarif/v2 v2.3.3
27-
github.com/pkg/errors v0.9.1
2827
github.com/shteou/go-ignore v0.3.1
2928
github.com/spdx/tools-golang v0.5.5
3029
github.com/spf13/cobra v1.10.1
@@ -125,6 +124,7 @@ require (
125124
github.com/olekukonko/ll v0.0.9 // indirect
126125
github.com/opencontainers/go-digest v1.0.0 // indirect
127126
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
127+
github.com/pkg/errors v0.9.1 // indirect
128128
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
129129
github.com/prometheus/client_golang v1.23.2 // indirect
130130
github.com/prometheus/client_model v0.6.2 // indirect

parser/cyclonedx/cyclonedx_test.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ package cyclonedx
22

33
import (
44
"testing"
5-
6-
"github.com/pkg/errors"
75
)
86

97
func TestCycloneDXParserValid(t *testing.T) {
8+
t.Parallel()
9+
1010
// generated by syft packages docker:devopps/busybox:latest -o cyclonedx --file report.xml
1111
// cat report.xml | cyclonedx-cli convert --input-format xml --output-format json
1212
sbom := `{
@@ -62,6 +62,8 @@ func TestCycloneDXParserValid(t *testing.T) {
6262
}
6363

6464
func TestCycloneDXParserInValid(t *testing.T) {
65+
t.Parallel()
66+
6567
// generated by syft packages docker:devopps/busybox:latest -o cyclonedx --file report.xml
6668
// cat report.xml | cyclonedx-cli convert --input-format xml --output-format json
6769
sbom := `{
@@ -111,12 +113,7 @@ func TestCycloneDXParserInValid(t *testing.T) {
111113
component := metadata.(map[string]any)["component"]
112114
currentSHA256 := component.(map[string]any)["version"]
113115

114-
var err error
115-
if expectedSHA256 != currentSHA256 {
116-
err = errors.Errorf("current SHA256 %s is different from the expected SHA256 %s", currentSHA256, expectedSHA256)
117-
}
118-
119-
if err == nil {
116+
if expectedSHA256 == currentSHA256 {
120117
t.Error("current SHA256 and expected SHA256 should not be equal")
121118
}
122119
}

0 commit comments

Comments
 (0)