From aea1e1152bb8c7d6f5f79440e61cac511a5e4786 Mon Sep 17 00:00:00 2001 From: Rado Chmiel Date: Tue, 30 Apr 2024 16:47:49 +0200 Subject: [PATCH] Modernizing golangci-lint configuration for latest version syntax (#726) Golangci-lint config syntax has changed in recent version, this removes warning messages from logs: ``` level=warning msg="[config_reader] The configuration option `run.skip-files` is deprecated, please use `issues.exclude-files`." level=warning msg="[config_reader] The configuration option `run.skip-dirs` is deprecated, please use `issues.exclude-dirs`." ``` Timeout is now config defined not command-line switch --- .golangci.yml | 9 ++++++--- default-go-lint.mk | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index da447c4f..0bb921be 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,8 +1,11 @@ run: - skip-dirs: - - vendor + timeout: 10m - skip-files: +issues: + exclude-dirs: + - "vendor" + + exclude-files: - ".*\\_test.go$" linters: diff --git a/default-go-lint.mk b/default-go-lint.mk index a0c8cfa4..1f82342a 100644 --- a/default-go-lint.mk +++ b/default-go-lint.mk @@ -13,7 +13,7 @@ # limitations under the License. -GOLANG_CI_VER ?= v1.52 +GOLANG_CI_VER ?= v1.57 GIT_ROOT_DIR ?= $(dir $(lastword $(MAKEFILE_LIST))) include $(GIT_ROOT_DIR)/detect-container-runtime.mk @@ -22,7 +22,7 @@ include $(GIT_ROOT_DIR)/detect-container-runtime.mk lint: ## Run Go linter against the codebase ifeq ($(CONTAINER_RUNNABLE), 0) $(RUN_CONTAINER_COMMAND) docker.io/golangci/golangci-lint:${GOLANG_CI_VER}-alpine \ - golangci-lint run ./... -v --timeout 10m + golangci-lint run ./... -v else - golangci-lint run ./... -v --timeout 10m + golangci-lint run ./... -v endif