1
0
Fork 0
mirror of https://github.com/spf13/cobra synced 2025-04-14 02:37:21 +00:00

Add stylecheck linter, replacement for golint

This revealed 2 capitalized error messages.

https://golangci-lint.run/usage/linters/#stylecheck
This commit is contained in:
Nir Soffer 2024-05-18 17:44:56 +03:00
parent 0585a83103
commit f43fbd557a
3 changed files with 3 additions and 3 deletions

View file

@ -49,7 +49,7 @@ linters:
#- scopelint #- scopelint
#- staticcheck #- staticcheck
#- structcheck ! deprecated since v1.49.0; replaced by 'unused' #- structcheck ! deprecated since v1.49.0; replaced by 'unused'
#- stylecheck - stylecheck
#- typecheck #- typecheck
- unconvert - unconvert
#- unparam #- unparam

View file

@ -875,7 +875,7 @@ func (c *Command) ArgsLenAtDash() int {
func (c *Command) execute(a []string) (err error) { func (c *Command) execute(a []string) (err error) {
if c == nil { 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 { if len(c.Deprecated) > 0 {

View file

@ -298,7 +298,7 @@ func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDi
} }
if err != nil { if err != nil {
// Unable to find the real command. E.g., <program> someInvalidCmd <TAB> // Unable to find the real command. E.g., <program> someInvalidCmd <TAB>
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 finalCmd.ctx = c.ctx