diff --git a/pkg/logutils/logutils.go b/pkg/logutils/logutils.go index 99af10cbed5d..0454d7927162 100644 --- a/pkg/logutils/logutils.go +++ b/pkg/logutils/logutils.go @@ -36,8 +36,12 @@ const ( // Printers. const ( - DebugKeyTabPrinter = "tab_printer" - DebugKeyTextPrinter = "text_printer" + DebugKeyCheckstylePrinter = "checkstyle_printer" + DebugKeyCodeClimatePrinter = "codeclimate_printer" + DebugKeySarifPrinter = "sarif_printer" + DebugKeyTabPrinter = "tab_printer" + DebugKeyTeamCityPrinter = "teamcity_printer" + DebugKeyTextPrinter = "text_printer" ) // Processors. diff --git a/pkg/printers/checkstyle.go b/pkg/printers/checkstyle.go index 6f82648bb969..0fb971d5ac25 100644 --- a/pkg/printers/checkstyle.go +++ b/pkg/printers/checkstyle.go @@ -9,6 +9,7 @@ import ( "github.com/go-xmlfmt/xmlfmt" "golang.org/x/exp/maps" + "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/result" ) @@ -21,10 +22,11 @@ type Checkstyle struct { sanitizer severitySanitizer } -func NewCheckstyle(w io.Writer) *Checkstyle { +func NewCheckstyle(log logutils.Log, w io.Writer) *Checkstyle { return &Checkstyle{ w: w, sanitizer: severitySanitizer{ + log: log.Child(logutils.DebugKeyCheckstylePrinter), // https://checkstyle.org/config.html#Severity // https://checkstyle.org/property_types.html#SeverityLevel allowedSeverities: []string{"ignore", "info", "warning", defaultCheckstyleSeverity}, diff --git a/pkg/printers/checkstyle_test.go b/pkg/printers/checkstyle_test.go index 9c2691311b56..23d77839515d 100644 --- a/pkg/printers/checkstyle_test.go +++ b/pkg/printers/checkstyle_test.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/result" ) @@ -41,15 +42,67 @@ func TestCheckstyle_Print(t *testing.T) { Column: 9, }, }, + { + FromLinter: "linter-c", + Severity: "", + Text: "without severity", + SourceLines: []string{ + "func foo() {", + "\tfmt.Println(\"bar\")", + "}", + }, + Pos: token.Position{ + Filename: "path/to/filec.go", + Offset: 5, + Line: 300, + Column: 10, + }, + }, + { + FromLinter: "linter-d", + Severity: "foo", + Text: "unknown severity", + SourceLines: []string{ + "func foo() {", + "\tfmt.Println(\"bar\")", + "}", + }, + Pos: token.Position{ + Filename: "path/to/filed.go", + Offset: 5, + Line: 300, + Column: 11, + }, + }, } buf := new(bytes.Buffer) - printer := NewCheckstyle(buf) + + log := logutils.NewStderrLog(logutils.DebugKeyEmpty) + log.SetLevel(logutils.LogLevelDebug) + + printer := NewCheckstyle(log, buf) err := printer.Print(issues) require.NoError(t, err) - expected := "\n\n\n \n \n \n \n \n \n\n" + expected := ` + + + + + + + + + + + + + + + +` assert.Equal(t, expected, strings.ReplaceAll(buf.String(), "\r", "")) } diff --git a/pkg/printers/codeclimate.go b/pkg/printers/codeclimate.go index d47e8a74cb89..8082b90f8d72 100644 --- a/pkg/printers/codeclimate.go +++ b/pkg/printers/codeclimate.go @@ -4,6 +4,7 @@ import ( "encoding/json" "io" + "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/result" ) @@ -16,10 +17,11 @@ type CodeClimate struct { sanitizer severitySanitizer } -func NewCodeClimate(w io.Writer) *CodeClimate { +func NewCodeClimate(log logutils.Log, w io.Writer) *CodeClimate { return &CodeClimate{ w: w, sanitizer: severitySanitizer{ + log: log.Child(logutils.DebugKeyCodeClimatePrinter), // https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#data-types allowedSeverities: []string{"info", "minor", "major", defaultCodeClimateSeverity, "blocker"}, defaultSeverity: defaultCodeClimateSeverity, diff --git a/pkg/printers/codeclimate_test.go b/pkg/printers/codeclimate_test.go index 236ed70f33c5..3ec6ad73cfae 100644 --- a/pkg/printers/codeclimate_test.go +++ b/pkg/printers/codeclimate_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/result" ) @@ -15,7 +16,7 @@ func TestCodeClimate_Print(t *testing.T) { issues := []result.Issue{ { FromLinter: "linter-a", - Severity: "warning", + Severity: "minor", Text: "some issue", Pos: token.Position{ Filename: "path/to/filea.go", @@ -42,28 +43,49 @@ func TestCodeClimate_Print(t *testing.T) { }, { FromLinter: "linter-c", - Text: "issue c", + Severity: "", + Text: "without severity", SourceLines: []string{ "func foo() {", - "\tfmt.Println(\"ccc\")", + "\tfmt.Println(\"bar\")", "}", }, Pos: token.Position{ Filename: "path/to/filec.go", - Offset: 6, - Line: 200, - Column: 2, + Offset: 5, + Line: 300, + Column: 10, + }, + }, + { + FromLinter: "linter-d", + Severity: "foo", + Text: "unknown severity", + SourceLines: []string{ + "func foo() {", + "\tfmt.Println(\"bar\")", + "}", + }, + Pos: token.Position{ + Filename: "path/to/filed.go", + Offset: 5, + Line: 300, + Column: 11, }, }, } buf := new(bytes.Buffer) - printer := NewCodeClimate(buf) + + log := logutils.NewStderrLog(logutils.DebugKeyEmpty) + log.SetLevel(logutils.LogLevelDebug) + + printer := NewCodeClimate(log, buf) err := printer.Print(issues) require.NoError(t, err) - expected := `[{"description":"linter-a: some issue","check_name":"linter-a","severity":"critical","fingerprint":"BA73C5DF4A6FD8462FFF1D3140235777","location":{"path":"path/to/filea.go","lines":{"begin":10}}},{"description":"linter-b: another issue","check_name":"linter-b","severity":"major","fingerprint":"0777B4FE60242BD8B2E9B7E92C4B9521","location":{"path":"path/to/fileb.go","lines":{"begin":300}}},{"description":"linter-c: issue c","check_name":"linter-c","severity":"critical","fingerprint":"BEE6E9FBB6BFA4B7DB9FB036697FB036","location":{"path":"path/to/filec.go","lines":{"begin":200}}}] + expected := `[{"description":"linter-a: some issue","check_name":"linter-a","severity":"minor","fingerprint":"BA73C5DF4A6FD8462FFF1D3140235777","location":{"path":"path/to/filea.go","lines":{"begin":10}}},{"description":"linter-b: another issue","check_name":"linter-b","severity":"major","fingerprint":"0777B4FE60242BD8B2E9B7E92C4B9521","location":{"path":"path/to/fileb.go","lines":{"begin":300}}},{"description":"linter-c: without severity","check_name":"linter-c","severity":"critical","fingerprint":"84F89700554F16CCEB6C0BB481B44AD2","location":{"path":"path/to/filec.go","lines":{"begin":300}}},{"description":"linter-d: unknown severity","check_name":"linter-d","severity":"critical","fingerprint":"340BB02E7B583B9727D73765CB64F56F","location":{"path":"path/to/filed.go","lines":{"begin":300}}}] ` assert.Equal(t, expected, buf.String()) diff --git a/pkg/printers/json.go b/pkg/printers/json.go index f2f8f11c5567..8fc94649f768 100644 --- a/pkg/printers/json.go +++ b/pkg/printers/json.go @@ -14,7 +14,7 @@ type JSON struct { w io.Writer } -func NewJSON(rd *report.Data, w io.Writer) *JSON { +func NewJSON(w io.Writer, rd *report.Data) *JSON { return &JSON{ rd: rd, w: w, diff --git a/pkg/printers/json_test.go b/pkg/printers/json_test.go index a28dbcf35369..1ce3690fb168 100644 --- a/pkg/printers/json_test.go +++ b/pkg/printers/json_test.go @@ -44,7 +44,7 @@ func TestJSON_Print(t *testing.T) { buf := new(bytes.Buffer) - printer := NewJSON(nil, buf) + printer := NewJSON(buf, nil) err := printer.Print(issues) require.NoError(t, err) diff --git a/pkg/printers/junitxml.go b/pkg/printers/junitxml.go index 46ffc22bb058..bc755b256d96 100644 --- a/pkg/printers/junitxml.go +++ b/pkg/printers/junitxml.go @@ -21,7 +21,7 @@ type JunitXML struct { w io.Writer } -func NewJunitXML(extended bool, w io.Writer) *JunitXML { +func NewJunitXML(w io.Writer, extended bool) *JunitXML { return &JunitXML{ extended: extended, w: w, diff --git a/pkg/printers/junitxml_test.go b/pkg/printers/junitxml_test.go index e4dfde195dfa..4cf99789124c 100644 --- a/pkg/printers/junitxml_test.go +++ b/pkg/printers/junitxml_test.go @@ -105,7 +105,7 @@ Details: func foo() { t.Parallel() buf := new(bytes.Buffer) - printer := NewJunitXML(test.extended, buf) + printer := NewJunitXML(buf, test.extended) err := printer.Print(issues) require.NoError(t, err) diff --git a/pkg/printers/printer.go b/pkg/printers/printer.go index 1336fc763147..ddabe4e2238b 100644 --- a/pkg/printers/printer.go +++ b/pkg/printers/printer.go @@ -115,29 +115,25 @@ func (c *Printer) createPrinter(format string, w io.Writer) (issuePrinter, error switch format { case config.OutFormatJSON: - p = NewJSON(c.reportData, w) + p = NewJSON(w, c.reportData) case config.OutFormatLineNumber, config.OutFormatColoredLineNumber: - p = NewText(c.cfg.PrintIssuedLine, - format == config.OutFormatColoredLineNumber, c.cfg.PrintLinterName, - c.log.Child(logutils.DebugKeyTextPrinter), w) + p = NewText(c.log, w, c.cfg.PrintLinterName, c.cfg.PrintIssuedLine, format == config.OutFormatColoredLineNumber) case config.OutFormatTab, config.OutFormatColoredTab: - p = NewTab(c.cfg.PrintLinterName, - format == config.OutFormatColoredTab, - c.log.Child(logutils.DebugKeyTabPrinter), w) + p = NewTab(c.log, w, c.cfg.PrintLinterName, format == config.OutFormatColoredTab) case config.OutFormatCheckstyle: - p = NewCheckstyle(w) + p = NewCheckstyle(c.log, w) case config.OutFormatCodeClimate: - p = NewCodeClimate(w) + p = NewCodeClimate(c.log, w) case config.OutFormatHTML: p = NewHTML(w) case config.OutFormatJunitXML, config.OutFormatJunitXMLExtended: - p = NewJunitXML(format == config.OutFormatJunitXMLExtended, w) + p = NewJunitXML(w, format == config.OutFormatJunitXMLExtended) case config.OutFormatGithubActions: p = NewGitHubAction(w) case config.OutFormatTeamCity: - p = NewTeamCity(w) + p = NewTeamCity(c.log, w) case config.OutFormatSarif: - p = NewSarif(w) + p = NewSarif(c.log, w) default: return nil, fmt.Errorf("unknown output format %q", format) } @@ -146,6 +142,8 @@ func (c *Printer) createPrinter(format string, w io.Writer) (issuePrinter, error } type severitySanitizer struct { + log logutils.Log + allowedSeverities []string defaultSeverity string } @@ -155,5 +153,7 @@ func (s *severitySanitizer) Clean(severity string) string { return severity } + s.log.Infof("severity '%s' is not inside %v, fallback to %s", severity, s.allowedSeverities, s.defaultSeverity) + return s.defaultSeverity } diff --git a/pkg/printers/sarif.go b/pkg/printers/sarif.go index dda75501e59e..88428b1f11a4 100644 --- a/pkg/printers/sarif.go +++ b/pkg/printers/sarif.go @@ -4,6 +4,7 @@ import ( "encoding/json" "io" + "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/result" ) @@ -22,10 +23,11 @@ type Sarif struct { sanitizer severitySanitizer } -func NewSarif(w io.Writer) *Sarif { +func NewSarif(log logutils.Log, w io.Writer) *Sarif { return &Sarif{ w: w, sanitizer: severitySanitizer{ + log: log.Child(logutils.DebugKeySarifPrinter), // https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/sarif-v2.1.0-errata01-os-complete.html#_Toc141790898 allowedSeverities: []string{"none", "note", "warning", defaultSarifSeverity}, defaultSeverity: defaultSarifSeverity, diff --git a/pkg/printers/sarif_test.go b/pkg/printers/sarif_test.go index 87c833de448c..f90606045682 100644 --- a/pkg/printers/sarif_test.go +++ b/pkg/printers/sarif_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/result" ) @@ -41,36 +42,60 @@ func TestSarif_Print(t *testing.T) { }, }, { - FromLinter: "linter-a", - Severity: "low", - Text: "some issue 2", + FromLinter: "linter-c", + Severity: "error", + Text: "some issue without column", Pos: token.Position{ - Filename: "path/to/filec.go", + Filename: "path/to/filed.go", Offset: 3, Line: 11, - Column: 5, }, }, { FromLinter: "linter-c", - Severity: "error", - Text: "some issue without column", + Severity: "", + Text: "without severity", + SourceLines: []string{ + "func foo() {", + "\tfmt.Println(\"bar\")", + "}", + }, + Pos: token.Position{ + Filename: "path/to/filec.go", + Offset: 5, + Line: 300, + Column: 10, + }, + }, + { + FromLinter: "linter-d", + Severity: "foo", + Text: "unknown severity", + SourceLines: []string{ + "func foo() {", + "\tfmt.Println(\"bar\")", + "}", + }, Pos: token.Position{ Filename: "path/to/filed.go", - Offset: 3, - Line: 11, + Offset: 5, + Line: 300, + Column: 11, }, }, } buf := new(bytes.Buffer) - printer := NewSarif(buf) + log := logutils.NewStderrLog(logutils.DebugKeyEmpty) + log.SetLevel(logutils.LogLevelDebug) + + printer := NewSarif(log, buf) err := printer.Print(issues) require.NoError(t, err) - expected := `{"version":"2.1.0","$schema":"https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.6.json","runs":[{"tool":{"driver":{"name":"golangci-lint"}},"results":[{"ruleId":"linter-a","level":"warning","message":{"text":"some issue"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"path/to/filea.go","index":0},"region":{"startLine":10,"startColumn":4}}}]},{"ruleId":"linter-b","level":"error","message":{"text":"another issue"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"path/to/fileb.go","index":0},"region":{"startLine":300,"startColumn":9}}}]},{"ruleId":"linter-a","level":"error","message":{"text":"some issue 2"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"path/to/filec.go","index":0},"region":{"startLine":11,"startColumn":5}}}]},{"ruleId":"linter-c","level":"error","message":{"text":"some issue without column"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"path/to/filed.go","index":0},"region":{"startLine":11,"startColumn":1}}}]}]}]} + expected := `{"version":"2.1.0","$schema":"https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.6.json","runs":[{"tool":{"driver":{"name":"golangci-lint"}},"results":[{"ruleId":"linter-a","level":"warning","message":{"text":"some issue"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"path/to/filea.go","index":0},"region":{"startLine":10,"startColumn":4}}}]},{"ruleId":"linter-b","level":"error","message":{"text":"another issue"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"path/to/fileb.go","index":0},"region":{"startLine":300,"startColumn":9}}}]},{"ruleId":"linter-c","level":"error","message":{"text":"some issue without column"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"path/to/filed.go","index":0},"region":{"startLine":11,"startColumn":1}}}]},{"ruleId":"linter-c","level":"error","message":{"text":"without severity"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"path/to/filec.go","index":0},"region":{"startLine":300,"startColumn":10}}}]},{"ruleId":"linter-d","level":"error","message":{"text":"unknown severity"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"path/to/filed.go","index":0},"region":{"startLine":300,"startColumn":11}}}]}]}]} ` assert.Equal(t, expected, buf.String()) @@ -79,7 +104,10 @@ func TestSarif_Print(t *testing.T) { func TestSarif_Print_empty(t *testing.T) { buf := new(bytes.Buffer) - printer := NewSarif(buf) + log := logutils.NewStderrLog(logutils.DebugKeyEmpty) + log.SetLevel(logutils.LogLevelDebug) + + printer := NewSarif(log, buf) err := printer.Print(nil) require.NoError(t, err) diff --git a/pkg/printers/tab.go b/pkg/printers/tab.go index 04260e09deb7..0a0b176b4a6b 100644 --- a/pkg/printers/tab.go +++ b/pkg/printers/tab.go @@ -20,11 +20,11 @@ type Tab struct { w io.Writer } -func NewTab(printLinterName, useColors bool, log logutils.Log, w io.Writer) *Tab { +func NewTab(log logutils.Log, w io.Writer, printLinterName, useColors bool) *Tab { return &Tab{ printLinterName: printLinterName, useColors: useColors, - log: log, + log: log.Child(logutils.DebugKeyTabPrinter), w: w, } } diff --git a/pkg/printers/tab_test.go b/pkg/printers/tab_test.go index fbd5dca6c65b..4fc9fa034589 100644 --- a/pkg/printers/tab_test.go +++ b/pkg/printers/tab_test.go @@ -87,7 +87,7 @@ path/to/fileb.go:300:9 another issue buf := new(bytes.Buffer) - printer := NewTab(test.printLinterName, test.useColors, logutils.NewStderrLog(logutils.DebugKeyEmpty), buf) + printer := NewTab(logutils.NewStderrLog(logutils.DebugKeyEmpty), buf, test.printLinterName, test.useColors) err := printer.Print(issues) require.NoError(t, err) diff --git a/pkg/printers/teamcity.go b/pkg/printers/teamcity.go index 1a24a3f75377..02bd0564abf3 100644 --- a/pkg/printers/teamcity.go +++ b/pkg/printers/teamcity.go @@ -5,6 +5,7 @@ import ( "io" "strings" + "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/result" ) @@ -25,7 +26,7 @@ type TeamCity struct { } // NewTeamCity output format outputs issues according to TeamCity service message format. -func NewTeamCity(w io.Writer) *TeamCity { +func NewTeamCity(log logutils.Log, w io.Writer) *TeamCity { return &TeamCity{ w: w, // https://www.jetbrains.com/help/teamcity/service-messages.html#Escaped+Values @@ -38,6 +39,7 @@ func NewTeamCity(w io.Writer) *TeamCity { "]", "|]", ), sanitizer: severitySanitizer{ + log: log.Child(logutils.DebugKeyTeamCityPrinter), // https://www.jetbrains.com/help/teamcity/service-messages.html#Inspection+Instance allowedSeverities: []string{"INFO", defaultTeamCitySeverity, "WARNING", "WEAK WARNING"}, defaultSeverity: defaultTeamCitySeverity, diff --git a/pkg/printers/teamcity_test.go b/pkg/printers/teamcity_test.go index 0a72e918558e..1eb29d33931d 100644 --- a/pkg/printers/teamcity_test.go +++ b/pkg/printers/teamcity_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/result" ) @@ -15,6 +16,7 @@ func TestTeamCity_Print(t *testing.T) { issues := []result.Issue{ { FromLinter: "linter-a", + Severity: "WARNING", Text: "warning issue", Pos: token.Position{ Filename: "path/to/filea.go", @@ -34,33 +36,56 @@ func TestTeamCity_Print(t *testing.T) { }, }, { - FromLinter: "linter-b", - Text: "info issue", + FromLinter: "linter-c", + Severity: "", + Text: "without severity", SourceLines: []string{ "func foo() {", "\tfmt.Println(\"bar\")", "}", }, Pos: token.Position{ - Filename: "path/to/fileb.go", + Filename: "path/to/filec.go", Offset: 5, Line: 300, - Column: 9, + Column: 10, + }, + }, + { + FromLinter: "linter-d", + Severity: "foo", + Text: "unknown severity", + SourceLines: []string{ + "func foo() {", + "\tfmt.Println(\"bar\")", + "}", + }, + Pos: token.Position{ + Filename: "path/to/filed.go", + Offset: 5, + Line: 300, + Column: 11, }, }, } buf := new(bytes.Buffer) - printer := NewTeamCity(buf) + + log := logutils.NewStderrLog(logutils.DebugKeyEmpty) + log.SetLevel(logutils.LogLevelDebug) + + printer := NewTeamCity(log, buf) err := printer.Print(issues) require.NoError(t, err) expected := `##teamcity[inspectionType id='linter-a' name='linter-a' description='linter-a' category='Golangci-lint reports'] -##teamcity[inspection typeId='linter-a' message='warning issue' file='path/to/filea.go' line='10' SEVERITY='ERROR'] +##teamcity[inspection typeId='linter-a' message='warning issue' file='path/to/filea.go' line='10' SEVERITY='WARNING'] ##teamcity[inspection typeId='linter-a' message='error issue' file='path/to/filea.go' line='10' SEVERITY='ERROR'] -##teamcity[inspectionType id='linter-b' name='linter-b' description='linter-b' category='Golangci-lint reports'] -##teamcity[inspection typeId='linter-b' message='info issue' file='path/to/fileb.go' line='300' SEVERITY='ERROR'] +##teamcity[inspectionType id='linter-c' name='linter-c' description='linter-c' category='Golangci-lint reports'] +##teamcity[inspection typeId='linter-c' message='without severity' file='path/to/filec.go' line='300' SEVERITY='ERROR'] +##teamcity[inspectionType id='linter-d' name='linter-d' description='linter-d' category='Golangci-lint reports'] +##teamcity[inspection typeId='linter-d' message='unknown severity' file='path/to/filed.go' line='300' SEVERITY='ERROR'] ` assert.Equal(t, expected, buf.String()) diff --git a/pkg/printers/text.go b/pkg/printers/text.go index 7d41943b4fea..9e60408f0400 100644 --- a/pkg/printers/text.go +++ b/pkg/printers/text.go @@ -13,20 +13,20 @@ import ( // Text prints issues with a human friendly representation. type Text struct { - printIssuedLine bool printLinterName bool + printIssuedLine bool useColors bool log logutils.Log w io.Writer } -func NewText(printIssuedLine, useColors, printLinterName bool, log logutils.Log, w io.Writer) *Text { +func NewText(log logutils.Log, w io.Writer, printLinterName, printIssuedLine, useColors bool) *Text { return &Text{ - printIssuedLine: printIssuedLine, printLinterName: printLinterName, + printIssuedLine: printIssuedLine, useColors: useColors, - log: log, + log: log.Child(logutils.DebugKeyTextPrinter), w: w, } } diff --git a/pkg/printers/text_test.go b/pkg/printers/text_test.go index bec16f72618a..55eda1827914 100644 --- a/pkg/printers/text_test.go +++ b/pkg/printers/text_test.go @@ -115,7 +115,7 @@ path/to/fileb.go:300:9: another issue buf := new(bytes.Buffer) - printer := NewText(test.printIssuedLine, test.useColors, test.printLinterName, logutils.NewStderrLog(logutils.DebugKeyEmpty), buf) + printer := NewText(logutils.NewStderrLog(logutils.DebugKeyEmpty), buf, test.printLinterName, test.printIssuedLine, test.useColors) err := printer.Print(issues) require.NoError(t, err)