From 5fdf8d164593d9bca8831afde99380493ceada5e Mon Sep 17 00:00:00 2001 From: Samuel Stoltenberg Date: Sun, 3 Dec 2023 14:48:31 -0600 Subject: [PATCH 1/4] Add golangci-lint workflow --- .github/workflows/golangci-lint.yml | 25 +++++++++++++++++++++++++ .golangci.yaml | 4 ++++ 2 files changed, 29 insertions(+) create mode 100644 .github/workflows/golangci-lint.yml create mode 100644 .golangci.yaml 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 From 12e5dbcc1bd5c11d08abf84254f2e29b90ceab48 Mon Sep 17 00:00:00 2001 From: Samuel Stoltenberg Date: Sun, 3 Dec 2023 14:52:15 -0600 Subject: [PATCH 2/4] Fix misspellings --- command_test.go | 2 +- context.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 { From 0176505ad710151c589fd14354c554b2b8d972fc Mon Sep 17 00:00:00 2001 From: Samuel Stoltenberg Date: Sun, 3 Dec 2023 14:57:59 -0600 Subject: [PATCH 3/4] Run make docs --- godoc-current.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 661f1d3e1b5c604fce03d98bbcf884d70ccf3c7a Mon Sep 17 00:00:00 2001 From: Samuel Stoltenberg Date: Sun, 3 Dec 2023 15:00:14 -0600 Subject: [PATCH 4/4] Run make v2approve --- testdata/godoc-v2.x.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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