Skip to content

Commit

Permalink
Merge pull request #1830 from skelouse/v2-maint
Browse files Browse the repository at this point in the history
v2 Add integration with golangci-lint
  • Loading branch information
skelouse authored Dec 4, 2023
2 parents d391482 + 661f1d3 commit 1a4c1da
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 4 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# https://golangci-lint.run/usage/configuration/
linters:
enable:
- misspell
2 changes: 1 addition & 1 deletion command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
}
Expand Down
2 changes: 1 addition & 1 deletion context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion godoc-current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion testdata/godoc-v2.x.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1a4c1da

Please sign in to comment.