Skip to content

Commit

Permalink
fix: use a script to lint each module (#15590)
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat authored Mar 29, 2023
1 parent bb86630 commit 9a07b7d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,5 @@ jobs:
with:
go-version: 1.20.2
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.51.2
- run: make lint

14 changes: 2 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -379,19 +379,9 @@ golangci_version=v1.51.2
lint:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run --timeout=10m
@sh ./scripts/go-lint-all.sh

lint-fix:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run --fix --out-format=tab --issues-exit-code=0

.PHONY: lint lint-fix

format:
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
$(golangci_lint_cmd) run --fix
.PHONY: format
.PHONY: lint

###############################################################################
### Protobuf ###
Expand Down
11 changes: 11 additions & 0 deletions scripts/go-lint-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -eu

export pwd=$(pwd)

for modfile in $(find . -name go.mod); do
echo "linting $(dirname $modfile)"
DIR=$(dirname $modfile)
(cd $DIR; golangci-lint run ./... --fix -c $pwd/.golangci.yml)
done

0 comments on commit 9a07b7d

Please sign in to comment.