File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package models
2
2
3
3
import (
4
4
"encoding/json"
5
+ "errors"
5
6
"fmt"
6
7
"gopkg.in/yaml.v3"
7
8
"strings"
@@ -555,7 +556,7 @@ type GithubActionsStrategy struct {
555
556
// UnmarshalYAML parses the `strategy` block and extracts `matrix`
556
557
func (o * GithubActionsStrategy ) UnmarshalYAML (node * yaml.Node ) error {
557
558
if node .Kind != yaml .MappingNode {
558
- return fmt . Errorf ("invalid yaml node type for strategy" )
559
+ return errors . New ("invalid yaml node type for strategy" )
559
560
}
560
561
for i := 0 ; i < len (node .Content ); i += 2 {
561
562
key := node .Content [i ].Value
@@ -564,7 +565,7 @@ func (o *GithubActionsStrategy) UnmarshalYAML(node *yaml.Node) error {
564
565
continue
565
566
}
566
567
if value .Kind != yaml .MappingNode {
567
- return fmt . Errorf ("matrix must be a mapping" )
568
+ return errors . New ("matrix must be a mapping" )
568
569
}
569
570
m := make (map [string ]StringList , len (value .Content )/ 2 )
570
571
// walk each matrix dimension
@@ -582,7 +583,7 @@ func (o *GithubActionsStrategy) UnmarshalYAML(node *yaml.Node) error {
582
583
case yaml .MappingNode :
583
584
var obj map [string ]interface {}
584
585
if err := item .Decode (& obj ); err != nil {
585
- return err
586
+ return fmt . Errorf ( "failed to decode matrix item: %w" , err )
586
587
}
587
588
b , err := json .Marshal (obj )
588
589
if err != nil {
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ func TestPurls(t *testing.T) {
52
52
"pkg:githubactions/org/owner@main#.github/workflows/ci.yml" ,
53
53
}
54
54
assert .ElementsMatch (t , i .Purls (* scannedPackage ), purls )
55
- assert .Equal (t , 20 , len ( scannedPackage .BuildDependencies ) )
55
+ assert .Len (t , scannedPackage .BuildDependencies , 20 )
56
56
assert .Equal (t , 4 , len (scannedPackage .PackageDependencies ))
57
57
}
58
58
You can’t perform that action at this time.
0 commit comments