From 16a449f84ea86556e9caa5d2d342e6f465f03ee3 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Mon, 28 Mar 2022 10:37:58 -0700 Subject: [PATCH] build: Make `make lint` faster (#1774) Signed-off-by: Alex Collins --- .github/workflows/golangci-lint.yml | 16 ++++++---------- .golangci.yml | 1 - Makefile | 4 ++-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 450a1eaff0..cc8af45e7f 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -8,16 +8,12 @@ jobs: golangci: name: lint runs-on: ubuntu-latest + timeout-minutes: 10 + env: + GOPATH: /home/runner/go steps: - uses: actions/checkout@v3 - - name: Setup Golang - uses: actions/setup-go@v3.0.0 with: - go-version: "1.17.1" - - name: Add to PATH - run: | - echo /home/runner/go/bin >> $GITHUB_PATH - - name: golangci-lint - run: | - echo 'GOPATH=/home/runner/go' >> $GITHUB_ENV - make lint + fetch-depth: 0 + - uses: golangci/golangci-lint-action@v2 + - run: git diff --exit-code diff --git a/.golangci.yml b/.golangci.yml index f78a49086b..55097b2488 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -29,4 +29,3 @@ linters: - unused - varcheck - whitespace - diff --git a/Makefile b/Makefile index 6c51fc8db7..43c14f416d 100644 --- a/Makefile +++ b/Makefile @@ -139,12 +139,12 @@ start: image kubectl -n argo-events wait --for=condition=Ready --timeout 60s pod --all $(GOPATH)/bin/golangci-lint: - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b `go env GOPATH`/bin v1.44.0 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b `go env GOPATH`/bin .PHONY: lint lint: $(GOPATH)/bin/golangci-lint go mod tidy - golangci-lint run --fix --verbose --concurrency 4 --timeout 5m + golangci-lint run --fix --verbose # release - targets only available on release branch ifneq ($(findstring release,$(GIT_BRANCH)),)