diff --git a/pkg/printers/tab.go b/pkg/printers/tab.go index 4a126bde..ffef4910 100644 --- a/pkg/printers/tab.go +++ b/pkg/printers/tab.go @@ -26,7 +26,7 @@ func NewTab(printLinterName bool, log logutils.Log, w io.Writer) *Tab { } } -func (p Tab) SprintfColored(ca color.Attribute, format string, args ...interface{}) string { +func (p *Tab) SprintfColored(ca color.Attribute, format string, args ...interface{}) string { c := color.New(ca) return c.Sprintf(format, args...) } @@ -45,7 +45,7 @@ func (p *Tab) Print(ctx context.Context, issues []result.Issue) error { return nil } -func (p Tab) printIssue(i *result.Issue, w io.Writer) { +func (p *Tab) printIssue(i *result.Issue, w io.Writer) { text := p.SprintfColored(color.FgRed, "%s", i.Text) if p.printLinterName { text = fmt.Sprintf("%s\t%s", i.FromLinter, text) diff --git a/pkg/printers/text.go b/pkg/printers/text.go index c8960e0e..d59391b2 100644 --- a/pkg/printers/text.go +++ b/pkg/printers/text.go @@ -31,7 +31,7 @@ func NewText(printIssuedLine, useColors, printLinterName bool, log logutils.Log, } } -func (p Text) SprintfColored(ca color.Attribute, format string, args ...interface{}) string { +func (p *Text) SprintfColored(ca color.Attribute, format string, args ...interface{}) string { if !p.useColors { return fmt.Sprintf(format, args...) } @@ -55,7 +55,7 @@ func (p *Text) Print(ctx context.Context, issues []result.Issue) error { return nil } -func (p Text) printIssue(i *result.Issue) { +func (p *Text) printIssue(i *result.Issue) { text := p.SprintfColored(color.FgRed, "%s", strings.TrimSpace(i.Text)) if p.printLinterName { text += fmt.Sprintf(" (%s)", i.FromLinter) @@ -67,7 +67,7 @@ func (p Text) printIssue(i *result.Issue) { fmt.Fprintf(p.w, "%s: %s\n", pos, text) } -func (p Text) printSourceCode(i *result.Issue) { +func (p *Text) printSourceCode(i *result.Issue) { for _, line := range i.SourceLines { fmt.Fprintln(p.w, line) } diff --git a/pkg/result/processors/autogenerated_exclude.go b/pkg/result/processors/autogenerated_exclude.go index f75ebaf5..bc6ba30e 100644 --- a/pkg/result/processors/autogenerated_exclude.go +++ b/pkg/result/processors/autogenerated_exclude.go @@ -32,7 +32,7 @@ func NewAutogeneratedExclude() *AutogeneratedExclude { var _ Processor = &AutogeneratedExclude{} -func (p AutogeneratedExclude) Name() string { +func (p *AutogeneratedExclude) Name() string { return "autogenerated_exclude" } @@ -130,4 +130,4 @@ func getDoc(filePath string) (string, error) { return strings.Join(docLines, "\n"), nil } -func (p AutogeneratedExclude) Finish() {} +func (p *AutogeneratedExclude) Finish() {} diff --git a/pkg/result/processors/filename_unadjuster.go b/pkg/result/processors/filename_unadjuster.go index 96540245..2aaafbf5 100644 --- a/pkg/result/processors/filename_unadjuster.go +++ b/pkg/result/processors/filename_unadjuster.go @@ -97,7 +97,7 @@ func NewFilenameUnadjuster(pkgs []*packages.Package, log logutils.Log) *Filename } } -func (p FilenameUnadjuster) Name() string { +func (p *FilenameUnadjuster) Name() string { return "filename_unadjuster" } @@ -128,4 +128,4 @@ func (p *FilenameUnadjuster) Process(issues []result.Issue) ([]result.Issue, err }), nil } -func (FilenameUnadjuster) Finish() {} +func (p *FilenameUnadjuster) Finish() {} diff --git a/pkg/result/processors/max_from_linter.go b/pkg/result/processors/max_from_linter.go index c58666c5..649ed86a 100644 --- a/pkg/result/processors/max_from_linter.go +++ b/pkg/result/processors/max_from_linter.go @@ -24,7 +24,7 @@ func NewMaxFromLinter(limit int, log logutils.Log, cfg *config.Config) *MaxFromL } } -func (p MaxFromLinter) Name() string { +func (p *MaxFromLinter) Name() string { return "max_from_linter" } @@ -44,7 +44,7 @@ func (p *MaxFromLinter) Process(issues []result.Issue) ([]result.Issue, error) { }), nil } -func (p MaxFromLinter) Finish() { +func (p *MaxFromLinter) Finish() { walkStringToIntMapSortedByValue(p.lc, func(linter string, count int) { if count > p.limit { p.log.Infof("%d/%d issues from linter %s were hidden, use --max-issues-per-linter", diff --git a/pkg/result/processors/max_per_file_from_linter.go b/pkg/result/processors/max_per_file_from_linter.go index e36446c9..64182e3e 100644 --- a/pkg/result/processors/max_per_file_from_linter.go +++ b/pkg/result/processors/max_per_file_from_linter.go @@ -31,7 +31,7 @@ func NewMaxPerFileFromLinter(cfg *config.Config) *MaxPerFileFromLinter { } } -func (p MaxPerFileFromLinter) Name() string { +func (p *MaxPerFileFromLinter) Name() string { return "max_per_file_from_linter" } @@ -56,4 +56,4 @@ func (p *MaxPerFileFromLinter) Process(issues []result.Issue) ([]result.Issue, e }), nil } -func (p MaxPerFileFromLinter) Finish() {} +func (p *MaxPerFileFromLinter) Finish() {} diff --git a/pkg/result/processors/max_same_issues.go b/pkg/result/processors/max_same_issues.go index 84fdf0c0..391ae5fa 100644 --- a/pkg/result/processors/max_same_issues.go +++ b/pkg/result/processors/max_same_issues.go @@ -28,7 +28,7 @@ func NewMaxSameIssues(limit int, log logutils.Log, cfg *config.Config) *MaxSameI } } -func (MaxSameIssues) Name() string { +func (p *MaxSameIssues) Name() string { return "max_same_issues" } @@ -48,7 +48,7 @@ func (p *MaxSameIssues) Process(issues []result.Issue) ([]result.Issue, error) { }), nil } -func (p MaxSameIssues) Finish() { +func (p *MaxSameIssues) Finish() { walkStringToIntMapSortedByValue(p.tc, func(text string, count int) { if count > p.limit { p.log.Infof("%d/%d issues with text %q were hidden, use --max-same-issues", diff --git a/pkg/result/processors/nolint.go b/pkg/result/processors/nolint.go index 492dfd72..181d3bf1 100644 --- a/pkg/result/processors/nolint.go +++ b/pkg/result/processors/nolint.go @@ -85,7 +85,7 @@ func NewNolint(log logutils.Log, dbManager *lintersdb.Manager, enabledLinters ma var _ Processor = &Nolint{} -func (p Nolint) Name() string { +func (p *Nolint) Name() string { return "nolint" } @@ -284,7 +284,7 @@ func (p *Nolint) extractInlineRangeFromComment(text string, g ast.Node, fset *to return buildRange(linters) } -func (p Nolint) Finish() { +func (p *Nolint) Finish() { if len(p.unknownLintersSet) == 0 { return } diff --git a/pkg/result/processors/uniq_by_line.go b/pkg/result/processors/uniq_by_line.go index 17167dde..dc0e1e8c 100644 --- a/pkg/result/processors/uniq_by_line.go +++ b/pkg/result/processors/uniq_by_line.go @@ -22,7 +22,7 @@ func NewUniqByLine(cfg *config.Config) *UniqByLine { var _ Processor = &UniqByLine{} -func (p UniqByLine) Name() string { +func (p *UniqByLine) Name() string { return "uniq_by_line" } @@ -55,4 +55,4 @@ func (p *UniqByLine) Process(issues []result.Issue) ([]result.Issue, error) { }), nil } -func (p UniqByLine) Finish() {} +func (p *UniqByLine) Finish() {}