-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add golangci-lint configuration and fix linting issues (#97)
Add golangci-lint using official golangci action and fix linting issues
- Loading branch information
1 parent
7f34de5
commit 9b4caac
Showing
5 changed files
with
62 additions
and
8 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 |
---|---|---|
|
@@ -16,14 +16,20 @@ jobs: | |
go-version: 1.18 | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@master | ||
uses: actions/checkout@v2 | ||
|
||
- name: run tests | ||
- name: Run golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.49.0 | ||
args: --config .golangci.yml | ||
|
||
- name: Run tests | ||
run: | | ||
go test -coverprofile=coverage.txt -covermode=atomic ./... | ||
go test -coverprofile=coverage.txt -covermode=atomic ./... | ||
- name: Publish coverage | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{secrets.CODECOV_TOKEN}} | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./coverage.txt |
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 @@ | ||
linters: | ||
enable: | ||
- govet | ||
- errcheck | ||
- staticcheck | ||
- unused | ||
- gofmt | ||
- goimports | ||
- gocritic | ||
|
||
linters-settings: | ||
govet: | ||
check-shadowing: true | ||
gocritic: | ||
check: | ||
- range-loop-ref | ||
- ifElseChain | ||
- typeSwitchVar | ||
- wrapperFunc | ||
|
||
run: | ||
timeout: 5m | ||
tests: true | ||
skip-dirs: | ||
- vendor | ||
|
||
issues: | ||
max-issues-per-linter: 0 | ||
max-same-issues: 0 | ||
exclude-use-default: false | ||
include: | ||
- EXC0001 | ||
|
||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- errcheck |
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
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
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