-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Add golangci github action and replace the deprecated golint #10187
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
facf582
Add golangci github action and replace the deprecated golint
z1cheng 280a7e7
Install if golangci-lint not exists
z1cheng cc45cda
Use -z operator
z1cheng 8d2b348
Merge remote-tracking branch 'upstream/main' into add_golangci_action
z1cheng 1b448b0
Fix json tag for DatadogSampleRate field in config.go
z1cheng 0f4781d
Add golangci linters
z1cheng 1fb98df
Revert DatadogSampleRate fix
z1cheng 37d88a4
Fix comments
z1cheng 7651b18
Add a new line
z1cheng f5557a6
fixup! Add a new line
z1cheng fa5948c
Add trigger condition
z1cheng b26e645
Add golint-check entry in makefile
z1cheng 88be7be
Run golint-check in a container
z1cheng 2c3eb0c
Merge branch 'main' of https://github.com/kubernetes/ingress-nginx in…
z1cheng 48d8684
Merge branch 'add_golangci_action' of https://github.com/z1cheng/ingr…
z1cheng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: golangci-lint | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, edited, synchronize, reopened] | ||
z1cheng marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| golangci: | ||
| name: lint | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
|
|
||
| - name: Set up Go | ||
| id: go | ||
| uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 | ||
| with: | ||
| go-version: '1.20' | ||
| check-latest: true | ||
|
|
||
| - name: golangci-lint | ||
| uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # tag=v3.6.0 | ||
z1cheng marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| with: | ||
| version: v1.53 | ||
z1cheng marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,241 @@ | ||
| run: | ||
z1cheng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| timeout: 10m | ||
| allow-parallel-runners: true | ||
|
|
||
| # Maximum issues count per one linter. Set to 0 to disable. Default is 50. | ||
| max-issues-per-linter: 0 | ||
|
|
||
| # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. | ||
| max-same-issues: 0 | ||
| linters: | ||
| disable-all: true | ||
| enable: | ||
| - asasalint | ||
| - asciicheck | ||
| - bidichk | ||
| - bodyclose | ||
| - contextcheck | ||
| - decorder | ||
| - dogsled | ||
| - dupl | ||
| - durationcheck | ||
| - errcheck | ||
| - errchkjson | ||
| - errname | ||
| - execinquery | ||
| - ginkgolinter | ||
| - gocheckcompilerdirectives | ||
| - goconst | ||
| - gocritic | ||
| - gocyclo | ||
| - godox | ||
| - gofmt | ||
z1cheng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - gofumpt | ||
| - goheader | ||
| - goimports | ||
| - gomoddirectives | ||
| - gomodguard | ||
| - goprintffuncname | ||
| - gosec | ||
| - gosimple | ||
| - govet | ||
| - grouper | ||
| - importas | ||
| - ineffassign | ||
| - loggercheck | ||
| - makezero | ||
| - misspell | ||
| - musttag | ||
| - nakedret | ||
| - nolintlint | ||
| - nosprintfhostport | ||
| - prealloc | ||
| - predeclared | ||
| - promlinter | ||
| - reassign | ||
| - revive | ||
| - rowserrcheck | ||
| - sqlclosecheck | ||
| - staticcheck | ||
| - stylecheck | ||
| - tenv | ||
| - testableexamples | ||
| - typecheck | ||
| - unconvert | ||
| - unparam | ||
| - unused | ||
| - usestdlibvars | ||
| - whitespace | ||
| # - containedctx | ||
| # - cyclop | ||
| # - dupword | ||
| # - errorlint | ||
| # - exhaustive | ||
| # - exhaustruct | ||
| # - exportloopref | ||
| # - forbidigo | ||
| # - forcetypeassert | ||
| # - funlen | ||
| # - gci | ||
| # - gochecknoglobals | ||
| # - gochecknoinits | ||
| # - gocognit | ||
| # - godot | ||
| # - goerr113 | ||
| # - gomnd | ||
| # - interfacebloat | ||
| # - ireturn | ||
| # - lll | ||
| # - maintidx | ||
| # - nestif | ||
| # - nilerr | ||
| # - nilnil | ||
| # - nlreturn | ||
| # - noctx | ||
| # - nonamedreturns | ||
| # - paralleltest | ||
| # - tagliatelle | ||
| # - testpackage | ||
| # - thelper | ||
| # - tparallel | ||
| # - varnamelen | ||
| # - wastedassign | ||
| # - wrapcheck | ||
| # - wsl | ||
| linters-settings: | ||
| gocyclo: | ||
| min-complexity: 40 | ||
| godox: | ||
| keywords: | ||
| - BUG | ||
| - FIXME | ||
| - HACK | ||
| errcheck: | ||
| check-type-assertions: true | ||
| check-blank: true | ||
| gocritic: | ||
| enabled-checks: | ||
| # Diagnostic | ||
| - appendAssign | ||
| - argOrder | ||
| - badCall | ||
| - badCond | ||
| - badLock | ||
| - badRegexp | ||
| - badSorting | ||
| - builtinShadowDecl | ||
| - caseOrder | ||
| - codegenComment | ||
| - commentedOutCode | ||
| - deferInLoop | ||
| - deprecatedComment | ||
| - dupArg | ||
| - dupBranchBody | ||
| - dupCase | ||
| - dupSubExpr | ||
| - dynamicFmtString | ||
| - emptyDecl | ||
| - evalOrder | ||
| - exitAfterDefer | ||
| - externalErrorReassign | ||
| - filepathJoin | ||
| - flagDeref | ||
| - flagName | ||
| - mapKey | ||
| - nilValReturn | ||
| - offBy1 | ||
| - regexpPattern | ||
| - returnAfterHttpError | ||
| - sloppyReassign | ||
| - sloppyTypeAssert | ||
| - sortSlice | ||
| - sprintfQuotedString | ||
| - sqlQuery | ||
| - syncMapLoadAndDelete | ||
| - truncateCmp | ||
| - unnecessaryDefer | ||
| - weakCond | ||
|
|
||
| # Performance | ||
| - appendCombine | ||
| - equalFold | ||
| - hugeParam | ||
| - indexAlloc | ||
| - preferDecodeRune | ||
| - preferFprint | ||
| - preferStringWriter | ||
| - preferWriteByte | ||
| - rangeExprCopy | ||
| - rangeValCopy | ||
| - sliceClear | ||
| - stringXbytes | ||
|
|
||
| # Style | ||
| - assignOp | ||
| - boolExprSimplify | ||
| - captLocal | ||
| - commentFormatting | ||
| - commentedOutImport | ||
| - defaultCaseOrder | ||
| - deferUnlambda | ||
| - docStub | ||
| - dupImport | ||
| - elseif | ||
| - emptyFallthrough | ||
| - emptyStringTest | ||
| - exposedSyncMutex | ||
| - hexLiteral | ||
| - httpNoBody | ||
| - ifElseChain | ||
| - methodExprCall | ||
| - newDeref | ||
| - octalLiteral | ||
| - preferFilepathJoin | ||
| - redundantSprint | ||
| - regexpMust | ||
| - regexpSimplify | ||
| - ruleguard | ||
| - singleCaseSwitch | ||
| - sloppyLen | ||
| - stringConcatSimplify | ||
| - stringsCompare | ||
| - switchTrue | ||
| - timeCmpSimplify | ||
| - timeExprSimplify | ||
| - todoCommentWithoutDetail | ||
| - tooManyResultsChecker | ||
| - typeAssertChain | ||
| - typeDefFirst | ||
| - typeSwitchVar | ||
| - underef | ||
| - unlabelStmt | ||
| - unlambda | ||
| - unslice | ||
| - valSwap | ||
| - whyNoLint | ||
| - wrapperFunc | ||
| - yodaStyleExpr | ||
|
|
||
| # Opinionated | ||
| - builtinShadow | ||
| - importShadow | ||
| - initClause | ||
| - nestingReduce | ||
| - paramTypeCombine | ||
| - ptrToRefParam | ||
| - typeUnparen | ||
| - unnamedResult | ||
| - unnecessaryBlock | ||
| nolintlint: | ||
| # Enable to ensure that nolint directives are all used. Default is true. | ||
| allow-unused: false | ||
| # Disable to ensure that nolint directives don't have a leading space. Default is true. | ||
| # TODO(lint): Enforce machine-readable `nolint` directives | ||
| allow-leading-space: true | ||
| # Exclude following linters from requiring an explanation. Default is []. | ||
| allow-no-explanation: [] | ||
| # Enable to require an explanation of nonzero length after each nolint directive. Default is false. | ||
| # TODO(lint): Enforce explanations for `nolint` directives | ||
| require-explanation: false | ||
| # Enable to require nolint directives to mention the specific linter being suppressed. Default is false. | ||
| require-specific: true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.