From 1c3278c2fa7733e61dbca92cbb3e8cd5ce6a848b Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Tue, 22 Sep 2020 13:02:16 -0400 Subject: update revive lint to latest commit (#12921) * update revive lint to latest commit * make fmt * change import --- .../github.com/mgechev/revive/formatter/friendly.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'vendor/github.com/mgechev/revive/formatter/friendly.go') diff --git a/vendor/github.com/mgechev/revive/formatter/friendly.go b/vendor/github.com/mgechev/revive/formatter/friendly.go index a543eebe00..d0a3099f8f 100644 --- a/vendor/github.com/mgechev/revive/formatter/friendly.go +++ b/vendor/github.com/mgechev/revive/formatter/friendly.go @@ -10,11 +10,6 @@ import ( "github.com/olekukonko/tablewriter" ) -var ( - errorEmoji = color.RedString("✘") - warningEmoji = color.YellowString("⚠") -) - var newLines = map[rune]bool{ 0x000A: true, 0x000B: true, @@ -25,6 +20,14 @@ var newLines = map[rune]bool{ 0x2029: true, } +func getErrorEmoji() string { + return color.RedString("✘") +} + +func getWarningEmoji() string { + return color.YellowString("⚠") +} + // Friendly is an implementation of the Formatter interface // which formats the errors to JSON. type Friendly struct { @@ -68,9 +71,9 @@ func (f *Friendly) printFriendlyFailure(failure lint.Failure, severity lint.Seve } func (f *Friendly) printHeaderRow(failure lint.Failure, severity lint.Severity) { - emoji := warningEmoji + emoji := getWarningEmoji() if severity == lint.SeverityError { - emoji = errorEmoji + emoji = getErrorEmoji() } fmt.Print(f.table([][]string{{emoji, "https://revive.run/r#" + failure.RuleName, color.GreenString(failure.Failure)}})) } @@ -85,9 +88,9 @@ type statEntry struct { } func (f *Friendly) printSummary(errors, warnings int) { - emoji := warningEmoji + emoji := getWarningEmoji() if errors > 0 { - emoji = errorEmoji + emoji = getErrorEmoji() } problemsLabel := "problems" if errors+warnings == 1 { -- cgit v1.2.3