From 0585a83103b548f64ac2a9947557dce465cfa57e Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Sat, 18 May 2024 17:42:02 +0300 Subject: [PATCH 1/2] 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/ --- .golangci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 22ae622e5..2c3562acb 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 From f43fbd557a3c2e2e322d2c4ff15acfd0447ac30b Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Sat, 18 May 2024 17:44:56 +0300 Subject: [PATCH 2/2] Add stylecheck linter, replacement for golint This revealed 2 capitalized error messages. https://golangci-lint.run/usage/linters/#stylecheck --- .golangci.yml | 2 +- command.go | 2 +- completions.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 2c3562acb..7b6d30216 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -49,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 b6f8f4b14..b31e22c86 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 ad7b6d0a2..c0c08b057 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