From 8003b74a10ef0d0d84fe3c408d3939d86fdeb210 Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Sun, 19 May 2024 05:12:02 +0300 Subject: [PATCH] Remove fully inactivated linters (#2148) * Remove fully inactivated linters Currently golangci-lint fails with these errors: ERRO [linters_context] golint: This linter is fully inactivated: it will not produce any reports. ERRO [linters_context] interfacer: This linter is fully inactivated: it will not produce any reports. ERRO [linters_context] maligned: This linter is fully inactivated: it will not produce any reports. I could not find any docs explaining what "fully inactivated" mean, but based this PR[1] it seems that these linters do nothing now. Removing the linters fixes this issue without changing linting, as they did not produce any report. Looking in the linters docs[2] I did not find a replacement for "interfacer" and "malinged" linters. "stylecheck" seems to be a replacement for "golint", but we need to fix the code to enable it. [1] https://github.com/golangci/golangci-lint/pull/4436 [2] https://golangci-lint.run/usage/linters/ * Add stylecheck linter, replacement for golint This revealed 2 capitalized error messages. https://golangci-lint.run/usage/linters/#stylecheck --- .golangci.yml | 5 +---- command.go | 2 +- completions.go | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 22ae622e..7b6d3021 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -33,16 +33,13 @@ linters: #- gocyclo #- gofmt - goimports - - golint #- gomnd #- goprintffuncname #- gosec - gosimple - govet - ineffassign - - interfacer #- lll - - maligned - megacheck #- misspell #- nakedret @@ -52,7 +49,7 @@ linters: #- scopelint #- staticcheck #- structcheck ! deprecated since v1.49.0; replaced by 'unused' - #- stylecheck + - stylecheck #- typecheck - unconvert #- unparam diff --git a/command.go b/command.go index b6f8f4b1..b31e22c8 100644 --- a/command.go +++ b/command.go @@ -875,7 +875,7 @@ func (c *Command) ArgsLenAtDash() int { func (c *Command) execute(a []string) (err error) { if c == nil { - return fmt.Errorf("Called Execute() on a nil Command") + return fmt.Errorf("called Execute() on a nil Command") } if len(c.Deprecated) > 0 { diff --git a/completions.go b/completions.go index ad7b6d0a..c0c08b05 100644 --- a/completions.go +++ b/completions.go @@ -298,7 +298,7 @@ func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDi } if err != nil { // Unable to find the real command. E.g., someInvalidCmd - return c, []string{}, ShellCompDirectiveDefault, fmt.Errorf("Unable to find a command for arguments: %v", trimmedArgs) + return c, []string{}, ShellCompDirectiveDefault, fmt.Errorf("unable to find a command for arguments: %v", trimmedArgs) } finalCmd.ctx = c.ctx