Skip to content

Commit

Permalink
check error first following Go convention
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Feb 10, 2024
1 parent 814044b commit 9ce8fbe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions rule_runner_label.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ func (rule *RuleRunnerLabel) verifyRunnerLabel(label *String) runnerOSCompat {

known := rule.getKnownLabels()
for _, k := range known {
matched, err := filepath.Match(k, l)
if matched {
m, err := filepath.Match(k, l)
if err != nil {
rule.Errorf(label.Pos, "label pattern %q is an invalid glob. kindly check list of labels in actionlint.yaml config file: %v", k, err)
return compatInvalid
}
if err != nil {
rule.Errorf(label.Pos, "label pattern %q is an invalid glob, kindly check list of labels in actionlint.yaml config file: %v", k, err)
if m {
return compatInvalid
}
}
Expand Down
2 changes: 1 addition & 1 deletion rule_runner_label_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestRuleRunnerLabelCheckLabels(t *testing.T) {
what: "user-defined labels with invalid glob pattern",
labels: []string{"self-hosted", "INSTANCE_TYPE=m6a.large"},
known: []string{"INSTANCE_TYPE=["},
errs: []string{`label pattern "INSTANCE_TYPE=[" is an invalid glob, kindly check list of labels in actionlint.yaml config file: syntax error in pattern`},
errs: []string{`label pattern "INSTANCE_TYPE=[" is an invalid glob. kindly check list of labels in actionlint.yaml config file: syntax error in pattern`},
},
{
what: "matrix",
Expand Down

0 comments on commit 9ce8fbe

Please sign in to comment.