Skip to content

Commit

Permalink
chore: update lint config
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenvechain committed Jan 12, 2024
1 parent 3e4e9bb commit bc3fc57
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/lint-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
args: --timeout=30m
# use the default if on main branch, otherwise use the pull request config
args: --timeout=30m --config=${{ github.event_name == 'pull_request' && '.golangci.pull-request.yml' || '.golangci.yml' }}
only-new-issues: true
skip-cache: true
skip-pkg-cache: true
Expand Down
13 changes: 13 additions & 0 deletions .golangci.pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Please refer to the official golangci-lint config documentation for more details:
# https://golangci-lint.run/usage/configuration/
# https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml

linters:
enable-all: true

run:
timeout: 10m
tests: false

issues:
max-issues-per-linter: 1000
4 changes: 3 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml

linters:
enable-all: true
disable:
- unused
- errcheck

run:
timeout: 10m
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ test-coverage:| go_version_check #@ Run the tests with coverage
@go tool cover -html=coverage.out

lint_command_check:
@command -v golangci-lint || (echo "golangci-lint not found, please install it from https://golangci-lint.run/usage/install/")
@command -v golangci-lint || (echo "golangci-lint not found, please install it from https://golangci-lint.run/usage/install/" && exit 1)

lint: | go_version_check lint_command_check #@ Run 'golangci-lint' on new code changes
@golangci-lint run --new
@golangci-lint run --new --config .golangci.pull-request.yml

lint-all: | go_version_check lint_command_check #@ Run 'golangci-lint' on the entire codebase
@golangci-lint run
@golangci-lint run --config .golangci.yml

0 comments on commit bc3fc57

Please sign in to comment.