@@ -14,26 +14,26 @@ const defaultGitHubSeverity = "error"
14
14
15
15
const filenameGitHubActionProblemMatchers = "golangci-lint-action-problem-matchers.json"
16
16
17
- // GitHubProblemMatchers defines the root of problem matchers.
17
+ // GHProblemMatchers defines the root of problem matchers.
18
18
// - https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md
19
19
// - https://github.com/actions/toolkit/blob/main/docs/commands.md#problem-matchers
20
- type GitHubProblemMatchers struct {
21
- Matchers []GitHubMatcher `json:"problemMatcher,omitempty"`
20
+ type GHProblemMatchers struct {
21
+ Matchers []GHMatcher `json:"problemMatcher,omitempty"`
22
22
}
23
23
24
- // GitHubMatcher defines a problem matcher.
25
- type GitHubMatcher struct {
24
+ // GHMatcher defines a problem matcher.
25
+ type GHMatcher struct {
26
26
// Owner an ID field that can be used to remove or replace the problem matcher.
27
27
// **required**
28
28
Owner string `json:"owner,omitempty"`
29
29
// Severity indicates the default severity, either 'warning' or 'error' case-insensitive.
30
30
// Defaults to 'error'.
31
- Severity string `json:"severity,omitempty"`
32
- Pattern []GitHubPattern `json:"pattern,omitempty"`
31
+ Severity string `json:"severity,omitempty"`
32
+ Pattern []GHPattern `json:"pattern,omitempty"`
33
33
}
34
34
35
- // GitHubPattern defines a pattern for a problem matcher.
36
- type GitHubPattern struct {
35
+ // GHPattern defines a pattern for a problem matcher.
36
+ type GHPattern struct {
37
37
// Regexp the regexp pattern that provides the groups to match against.
38
38
// **required**
39
39
Regexp string `json:"regexp,omitempty"`
@@ -58,20 +58,20 @@ type GitHubPattern struct {
58
58
Loop bool `json:"loop,omitempty"`
59
59
}
60
60
61
- type GitHub struct {
61
+ type GitHubActionProblemMatchers struct {
62
62
tempPath string
63
63
w io.Writer
64
64
}
65
65
66
- // NewGitHub output format outputs issues according to GitHub actions the problem matcher regexp.
67
- func NewGitHub (w io.Writer ) * GitHub {
68
- return & GitHub {
66
+ // NewGitHubActionProblemMatchers output format outputs issues according to GitHub actions the problem matcher regexp.
67
+ func NewGitHubActionProblemMatchers (w io.Writer ) * GitHubActionProblemMatchers {
68
+ return & GitHubActionProblemMatchers {
69
69
tempPath : filepath .Join (os .TempDir (), filenameGitHubActionProblemMatchers ),
70
70
w : w ,
71
71
}
72
72
}
73
73
74
- func (p * GitHub ) Print (issues []result.Issue ) error {
74
+ func (p * GitHubActionProblemMatchers ) Print (issues []result.Issue ) error {
75
75
// Note: the file with the problem matcher definition should not be removed.
76
76
// A sleep can mitigate this problem but this will be flaky.
77
77
//
@@ -99,7 +99,7 @@ func (p *GitHub) Print(issues []result.Issue) error {
99
99
return nil
100
100
}
101
101
102
- func (p * GitHub ) storeProblemMatcher () (string , error ) {
102
+ func (p * GitHubActionProblemMatchers ) storeProblemMatcher () (string , error ) {
103
103
file , err := os .Create (p .tempPath )
104
104
if err != nil {
105
105
return "" , err
@@ -115,13 +115,13 @@ func (p *GitHub) storeProblemMatcher() (string, error) {
115
115
return file .Name (), nil
116
116
}
117
117
118
- func generateProblemMatcher () GitHubProblemMatchers {
119
- return GitHubProblemMatchers {
120
- Matchers : []GitHubMatcher {
118
+ func generateProblemMatcher () GHProblemMatchers {
119
+ return GHProblemMatchers {
120
+ Matchers : []GHMatcher {
121
121
{
122
122
Owner : "golangci-lint-action" ,
123
123
Severity : "error" ,
124
- Pattern : []GitHubPattern {
124
+ Pattern : []GHPattern {
125
125
{
126
126
Regexp : `^([^\s]+)\s+([^:]+):(\d+):(?:(\d+):)?\s+(.+)$` ,
127
127
Severity : 1 ,
0 commit comments