Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2 Add integration with golangci-lint #1830

Merged
merged 4 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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