Skip to content

Commit 9b61a82

Browse files
committed
review
1 parent cddbda7 commit 9b61a82

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

pkg/golinters/mirror.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,43 @@ import (
1212
)
1313

1414
func NewMirror() *goanalysis.Linter {
15-
var ( // Issue reporter related.
15+
var (
1616
mu sync.Mutex
1717
issues []goanalysis.Issue
1818
)
1919

2020
a := mirror.NewAnalyzer()
2121
a.Run = func(pass *analysis.Pass) (any, error) {
22-
// mirror only lints test files if the `--with-tests` flag is passed, so we
23-
// pass the `with-tests` flag as true to the analyzer before running it. This
24-
// can be turned off by using the regular golangci-lint flags such as `--tests`
25-
// or `--skip-files` or can be disabled per linter via exclude rules (see
26-
// https://github.com/golangci/golangci-lint/issues/2527#issuecomment-1023707262)
27-
withTests := true
28-
violations := mirror.Run(pass, withTests)
22+
// mirror only lints test files if the `--with-tests` flag is passed,
23+
// so we pass the `with-tests` flag as true to the analyzer before running it.
24+
// This can be turned off by using the regular golangci-lint flags such as `--tests` or `--skip-files`
25+
// or can be disabled per linter via exclude rules.
26+
// (see https://github.com/golangci/golangci-lint/issues/2527#issuecomment-1023707262)
27+
violations := mirror.Run(pass, true)
2928

3029
if len(violations) == 0 {
3130
return nil, nil
3231
}
3332

34-
for i := range violations {
35-
tmp := violations[i].Issue(pass.Fset)
33+
for index := range violations {
34+
i := violations[index].Issue(pass.Fset)
3635

3736
issue := result.Issue{
3837
FromLinter: a.Name,
39-
Text: tmp.Message,
40-
Pos: tmp.Start,
38+
Text: i.Message,
39+
Pos: i.Start,
4140
}
4241

43-
if len(tmp.InlineFix) > 0 {
42+
if len(i.InlineFix) > 0 {
4443
issue.Replacement = &result.Replacement{
4544
Inline: &result.InlineFix{
46-
StartCol: tmp.Start.Column - 1,
47-
Length: len(tmp.Original),
48-
NewString: tmp.InlineFix,
45+
StartCol: i.Start.Column - 1,
46+
Length: len(i.Original),
47+
NewString: i.InlineFix,
4948
},
5049
}
5150
}
51+
5252
mu.Lock()
5353
issues = append(issues, goanalysis.NewIssue(&issue, pass))
5454
mu.Unlock()

0 commit comments

Comments
 (0)