From 98c136e0bd25fe390e1b04163c99f6027ccd4c79 Mon Sep 17 00:00:00 2001 From: Trajan0x Date: Mon, 4 Mar 2024 17:05:24 +0100 Subject: [PATCH 1/2] Add recursive lint --- .github/workflows/go.yml | 2 +- make/repo.Makefile | 3 +++ make/scripts/lint.sh | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 make/scripts/lint.sh diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f91581fa69..e8afde6877 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -346,7 +346,7 @@ jobs: with: working-directory: ${{matrix.package}}/ # 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.56.1 + version: v1.56.2 # see: https://github.com/golangci/golangci-lint/issues/2654 args: --timeout=60m env: diff --git a/make/repo.Makefile b/make/repo.Makefile index 82eb90ad48..67f889f9d0 100644 --- a/make/repo.Makefile +++ b/make/repo.Makefile @@ -30,6 +30,9 @@ tidy: ## Runs go mod tidy on all go.mod files in the repo go work sync $(GIT_ROOT)/make/scripts/tidy.sh +lint-go: ## Runs make lint in all go.mod files in the repo. + $(GIT_ROOT)/make/scripts/lint.sh + docker-clean: ## stops and removes all containers at once docker ps -aq | xargs docker stop | xargs docker rm docker network prune diff --git a/make/scripts/lint.sh b/make/scripts/lint.sh new file mode 100755 index 0000000000..061fa8cb64 --- /dev/null +++ b/make/scripts/lint.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +find . -name go.mod -print0 | while IFS= read -r -d '' f; do + echo "linting $(dirname "$f")" + (cd "$(dirname "$f")" || exit; go mod tidy) +done From fd270820021d11b8414ca79496302dadeffe894f Mon Sep 17 00:00:00 2001 From: trajan0x <83933037+trajan0x@users.noreply.github.com> Date: Mon, 4 Mar 2024 17:47:16 +0100 Subject: [PATCH 2/2] Update make/scripts/lint.sh Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- make/scripts/lint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/make/scripts/lint.sh b/make/scripts/lint.sh index 061fa8cb64..ce08255ac4 100755 --- a/make/scripts/lint.sh +++ b/make/scripts/lint.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash +set -e find . -name go.mod -print0 | while IFS= read -r -d '' f; do echo "linting $(dirname "$f")" (cd "$(dirname "$f")" || exit; go mod tidy)