From e4cff6703b496e1097eb2195538057085f61a0d0 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Fri, 29 Mar 2024 19:48:15 +0000 Subject: [PATCH] rename golangci-lint config file and use golangci-lint-action to lint Signed-off-by: Matthieu MOREL --- .github/workflows/pr-linter-check.yml | 12 ++++++++++-- golangci.yaml => .golangci.yaml | 1 + hack/build-image/Dockerfile | 2 +- hack/lint.sh | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) rename golangci.yaml => .golangci.yaml (99%) diff --git a/.github/workflows/pr-linter-check.yml b/.github/workflows/pr-linter-check.yml index f2dc7c6e6c8..c64904920eb 100644 --- a/.github/workflows/pr-linter-check.yml +++ b/.github/workflows/pr-linter-check.yml @@ -8,7 +8,15 @@ jobs: steps: - name: Check out the code - uses: actions/checkout@v2 + uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + cache: false - name: Linter check - run: make lint + uses: golangci/golangci-lint-action@v4 + with: + version: v1.57.2 + args: --verbose diff --git a/golangci.yaml b/.golangci.yaml similarity index 99% rename from golangci.yaml rename to .golangci.yaml index c96c7428e06..82eddb95e82 100644 --- a/golangci.yaml +++ b/.golangci.yaml @@ -253,6 +253,7 @@ linters-settings: - expected-actual - go-require - float-compare + - nil-compare - require-error - suite-dont-use-pkg - suite-extra-assert-call diff --git a/hack/build-image/Dockerfile b/hack/build-image/Dockerfile index 161a837f0b6..e2d966f73a3 100644 --- a/hack/build-image/Dockerfile +++ b/hack/build-image/Dockerfile @@ -93,7 +93,7 @@ RUN ARCH=$(go env GOARCH) && \ chmod +x /usr/bin/goreleaser # get golangci-lint -RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.0 +RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.57.2 # install kubectl RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/$(go env GOARCH)/kubectl diff --git a/hack/lint.sh b/hack/lint.sh index 13ed64caba7..4cb686d4bfc 100755 --- a/hack/lint.sh +++ b/hack/lint.sh @@ -21,7 +21,7 @@ golangci-lint cache status # Enable GL_DEBUG line below for debug messages for golangci-lint # export GL_DEBUG=loader,gocritic,env -CMD="golangci-lint run -c $HACK_DIR/../golangci.yaml" +CMD="golangci-lint run -c $HACK_DIR/../.golangci.yaml" echo "Running $CMD" eval $CMD