-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add golangci linter in github workflow action
enable basic linters using golangci-lint tool
- Loading branch information
1 parent
1e0fedf
commit 71d0f98
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,37 @@ | ||
name: golangci-lint | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
golangci: | ||
name: golangci-lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22' | ||
cache: false | ||
- name: Run golangci-lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.59 | ||
|
||
# Optional: working directory, useful for monorepos | ||
# working-directory: somedir | ||
|
||
# Optional: golangci-lint command line arguments. | ||
# | ||
# Note: By default, the `.golangci.yml` file should be at the root of the repository. | ||
# The location of the configuration file can be changed by using `--config=` | ||
# args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0 | ||
args: --verbose |
This file contains 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,21 @@ | ||
run: | ||
timeout: 5m | ||
exclude-dirs: | ||
- vendor | ||
- examples | ||
|
||
linters: | ||
enable: | ||
- errcheck | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- unused | ||
|
||
linters-settings: | ||
gocyclo: | ||
min-complexity: 20 |