Skip to content

Commit d193989

Browse files
authored
chore: Do not use methods on pointer and value receivers (#3321)
1 parent d5d671f commit d193989

9 files changed

+19
-19
lines changed

pkg/printers/tab.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func NewTab(printLinterName bool, log logutils.Log, w io.Writer) *Tab {
2626
}
2727
}
2828

29-
func (p Tab) SprintfColored(ca color.Attribute, format string, args ...interface{}) string {
29+
func (p *Tab) SprintfColored(ca color.Attribute, format string, args ...interface{}) string {
3030
c := color.New(ca)
3131
return c.Sprintf(format, args...)
3232
}
@@ -45,7 +45,7 @@ func (p *Tab) Print(ctx context.Context, issues []result.Issue) error {
4545
return nil
4646
}
4747

48-
func (p Tab) printIssue(i *result.Issue, w io.Writer) {
48+
func (p *Tab) printIssue(i *result.Issue, w io.Writer) {
4949
text := p.SprintfColored(color.FgRed, "%s", i.Text)
5050
if p.printLinterName {
5151
text = fmt.Sprintf("%s\t%s", i.FromLinter, text)

pkg/printers/text.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func NewText(printIssuedLine, useColors, printLinterName bool, log logutils.Log,
3131
}
3232
}
3333

34-
func (p Text) SprintfColored(ca color.Attribute, format string, args ...interface{}) string {
34+
func (p *Text) SprintfColored(ca color.Attribute, format string, args ...interface{}) string {
3535
if !p.useColors {
3636
return fmt.Sprintf(format, args...)
3737
}
@@ -55,7 +55,7 @@ func (p *Text) Print(ctx context.Context, issues []result.Issue) error {
5555
return nil
5656
}
5757

58-
func (p Text) printIssue(i *result.Issue) {
58+
func (p *Text) printIssue(i *result.Issue) {
5959
text := p.SprintfColored(color.FgRed, "%s", strings.TrimSpace(i.Text))
6060
if p.printLinterName {
6161
text += fmt.Sprintf(" (%s)", i.FromLinter)
@@ -67,7 +67,7 @@ func (p Text) printIssue(i *result.Issue) {
6767
fmt.Fprintf(p.w, "%s: %s\n", pos, text)
6868
}
6969

70-
func (p Text) printSourceCode(i *result.Issue) {
70+
func (p *Text) printSourceCode(i *result.Issue) {
7171
for _, line := range i.SourceLines {
7272
fmt.Fprintln(p.w, line)
7373
}

pkg/result/processors/autogenerated_exclude.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func NewAutogeneratedExclude() *AutogeneratedExclude {
3232

3333
var _ Processor = &AutogeneratedExclude{}
3434

35-
func (p AutogeneratedExclude) Name() string {
35+
func (p *AutogeneratedExclude) Name() string {
3636
return "autogenerated_exclude"
3737
}
3838

@@ -130,4 +130,4 @@ func getDoc(filePath string) (string, error) {
130130
return strings.Join(docLines, "\n"), nil
131131
}
132132

133-
func (p AutogeneratedExclude) Finish() {}
133+
func (p *AutogeneratedExclude) Finish() {}

pkg/result/processors/filename_unadjuster.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func NewFilenameUnadjuster(pkgs []*packages.Package, log logutils.Log) *Filename
9797
}
9898
}
9999

100-
func (p FilenameUnadjuster) Name() string {
100+
func (p *FilenameUnadjuster) Name() string {
101101
return "filename_unadjuster"
102102
}
103103

@@ -128,4 +128,4 @@ func (p *FilenameUnadjuster) Process(issues []result.Issue) ([]result.Issue, err
128128
}), nil
129129
}
130130

131-
func (FilenameUnadjuster) Finish() {}
131+
func (p *FilenameUnadjuster) Finish() {}

pkg/result/processors/max_from_linter.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func NewMaxFromLinter(limit int, log logutils.Log, cfg *config.Config) *MaxFromL
2424
}
2525
}
2626

27-
func (p MaxFromLinter) Name() string {
27+
func (p *MaxFromLinter) Name() string {
2828
return "max_from_linter"
2929
}
3030

@@ -44,7 +44,7 @@ func (p *MaxFromLinter) Process(issues []result.Issue) ([]result.Issue, error) {
4444
}), nil
4545
}
4646

47-
func (p MaxFromLinter) Finish() {
47+
func (p *MaxFromLinter) Finish() {
4848
walkStringToIntMapSortedByValue(p.lc, func(linter string, count int) {
4949
if count > p.limit {
5050
p.log.Infof("%d/%d issues from linter %s were hidden, use --max-issues-per-linter",

pkg/result/processors/max_per_file_from_linter.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func NewMaxPerFileFromLinter(cfg *config.Config) *MaxPerFileFromLinter {
3131
}
3232
}
3333

34-
func (p MaxPerFileFromLinter) Name() string {
34+
func (p *MaxPerFileFromLinter) Name() string {
3535
return "max_per_file_from_linter"
3636
}
3737

@@ -56,4 +56,4 @@ func (p *MaxPerFileFromLinter) Process(issues []result.Issue) ([]result.Issue, e
5656
}), nil
5757
}
5858

59-
func (p MaxPerFileFromLinter) Finish() {}
59+
func (p *MaxPerFileFromLinter) Finish() {}

pkg/result/processors/max_same_issues.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func NewMaxSameIssues(limit int, log logutils.Log, cfg *config.Config) *MaxSameI
2828
}
2929
}
3030

31-
func (MaxSameIssues) Name() string {
31+
func (p *MaxSameIssues) Name() string {
3232
return "max_same_issues"
3333
}
3434

@@ -48,7 +48,7 @@ func (p *MaxSameIssues) Process(issues []result.Issue) ([]result.Issue, error) {
4848
}), nil
4949
}
5050

51-
func (p MaxSameIssues) Finish() {
51+
func (p *MaxSameIssues) Finish() {
5252
walkStringToIntMapSortedByValue(p.tc, func(text string, count int) {
5353
if count > p.limit {
5454
p.log.Infof("%d/%d issues with text %q were hidden, use --max-same-issues",

pkg/result/processors/nolint.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func NewNolint(log logutils.Log, dbManager *lintersdb.Manager, enabledLinters ma
8585

8686
var _ Processor = &Nolint{}
8787

88-
func (p Nolint) Name() string {
88+
func (p *Nolint) Name() string {
8989
return "nolint"
9090
}
9191

@@ -284,7 +284,7 @@ func (p *Nolint) extractInlineRangeFromComment(text string, g ast.Node, fset *to
284284
return buildRange(linters)
285285
}
286286

287-
func (p Nolint) Finish() {
287+
func (p *Nolint) Finish() {
288288
if len(p.unknownLintersSet) == 0 {
289289
return
290290
}

pkg/result/processors/uniq_by_line.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func NewUniqByLine(cfg *config.Config) *UniqByLine {
2222

2323
var _ Processor = &UniqByLine{}
2424

25-
func (p UniqByLine) Name() string {
25+
func (p *UniqByLine) Name() string {
2626
return "uniq_by_line"
2727
}
2828

@@ -55,4 +55,4 @@ func (p *UniqByLine) Process(issues []result.Issue) ([]result.Issue, error) {
5555
}), nil
5656
}
5757

58-
func (p UniqByLine) Finish() {}
58+
func (p *UniqByLine) Finish() {}

0 commit comments

Comments
 (0)