Skip to content

Commit 8a03db8

Browse files
committed
fmt
1 parent c7772d7 commit 8a03db8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

models/github_actions.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package models
22

33
import (
44
"encoding/json"
5+
"errors"
56
"fmt"
67
"gopkg.in/yaml.v3"
78
"strings"
@@ -555,7 +556,7 @@ type GithubActionsStrategy struct {
555556
// UnmarshalYAML parses the `strategy` block and extracts `matrix`
556557
func (o *GithubActionsStrategy) UnmarshalYAML(node *yaml.Node) error {
557558
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")
559560
}
560561
for i := 0; i < len(node.Content); i += 2 {
561562
key := node.Content[i].Value
@@ -564,7 +565,7 @@ func (o *GithubActionsStrategy) UnmarshalYAML(node *yaml.Node) error {
564565
continue
565566
}
566567
if value.Kind != yaml.MappingNode {
567-
return fmt.Errorf("matrix must be a mapping")
568+
return errors.New("matrix must be a mapping")
568569
}
569570
m := make(map[string]StringList, len(value.Content)/2)
570571
// walk each matrix dimension
@@ -582,7 +583,7 @@ func (o *GithubActionsStrategy) UnmarshalYAML(node *yaml.Node) error {
582583
case yaml.MappingNode:
583584
var obj map[string]interface{}
584585
if err := item.Decode(&obj); err != nil {
585-
return err
586+
return fmt.Errorf("failed to decode matrix item: %w", err)
586587
}
587588
b, err := json.Marshal(obj)
588589
if err != nil {

scanner/inventory_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func TestPurls(t *testing.T) {
5252
"pkg:githubactions/org/owner@main#.github/workflows/ci.yml",
5353
}
5454
assert.ElementsMatch(t, i.Purls(*scannedPackage), purls)
55-
assert.Equal(t, 20, len(scannedPackage.BuildDependencies))
55+
assert.Len(t, scannedPackage.BuildDependencies, 20)
5656
assert.Equal(t, 4, len(scannedPackage.PackageDependencies))
5757
}
5858

0 commit comments

Comments
 (0)