fix: use a script to lint each module (#15590)
This commit is contained in:
parent
bb8663093e
commit
9a07b7defe
7
.github/workflows/lint.yml
vendored
7
.github/workflows/lint.yml
vendored
@ -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
Makefile
14
Makefile
@ -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 ###
|
||||
|
||||
11
scripts/go-lint-all.sh
Normal file
11
scripts/go-lint-all.sh
Normal file
@ -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
|
||||
Loading…
Reference in New Issue
Block a user