diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000000..cc4019140b --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,25 @@ +name: golangci-lint +on: + push: + tags: + - v2.* + branches: + - v2-maint + pull_request: + branches: + - v2-maint +permissions: + contents: read +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v3 + with: + go-version: "1.20" + - uses: actions/checkout@v3 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest \ No newline at end of file diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000000..89b6e86615 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,4 @@ +# https://golangci-lint.run/usage/configuration/ +linters: + enable: + - misspell diff --git a/command_test.go b/command_test.go index 3aa2a45996..b3bcf8c562 100644 --- a/command_test.go +++ b/command_test.go @@ -341,7 +341,7 @@ func TestCommand_Run_CustomShellCompleteAcceptsMalformedFlags(t *testing.T) { }{ {testArgs: args{"--undefined"}, expectedOut: "found 0 args"}, {testArgs: args{"--number"}, expectedOut: "found 0 args"}, - {testArgs: args{"--number", "fourty-two"}, expectedOut: "found 0 args"}, + {testArgs: args{"--number", "forty-two"}, expectedOut: "found 0 args"}, {testArgs: args{"--number", "42"}, expectedOut: "found 0 args"}, {testArgs: args{"--number", "42", "newArg"}, expectedOut: "found 1 args"}, } diff --git a/context.go b/context.go index a45c120b55..8dd4765211 100644 --- a/context.go +++ b/context.go @@ -144,7 +144,7 @@ func (cCtx *Context) Lineage() []*Context { return lineage } -// Count returns the num of occurences of this flag +// Count returns the num of occurrences of this flag func (cCtx *Context) Count(name string) int { if fs := cCtx.lookupFlagSet(name); fs != nil { if cf, ok := fs.Lookup(name).Value.(Countable); ok { diff --git a/godoc-current.txt b/godoc-current.txt index 6016bd82e7..9be5107a98 100644 --- a/godoc-current.txt +++ b/godoc-current.txt @@ -649,7 +649,7 @@ func (cCtx *Context) Bool(name string) bool Bool looks up the value of a local BoolFlag, returns false if not found func (cCtx *Context) Count(name string) int - Count returns the num of occurences of this flag + Count returns the num of occurrences of this flag func (cCtx *Context) Duration(name string) time.Duration Duration looks up the value of a local DurationFlag, returns 0 if not found diff --git a/testdata/godoc-v2.x.txt b/testdata/godoc-v2.x.txt index 6016bd82e7..9be5107a98 100644 --- a/testdata/godoc-v2.x.txt +++ b/testdata/godoc-v2.x.txt @@ -649,7 +649,7 @@ func (cCtx *Context) Bool(name string) bool Bool looks up the value of a local BoolFlag, returns false if not found func (cCtx *Context) Count(name string) int - Count returns the num of occurences of this flag + Count returns the num of occurrences of this flag func (cCtx *Context) Duration(name string) time.Duration Duration looks up the value of a local DurationFlag, returns 0 if not found