Skip to content

Commit a6c16ab

Browse files
authored
add linter version check (#160)
Signed-off-by: npolshakova <[email protected]>
1 parent 9c541b9 commit a6c16ab

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ post-deploy-test: ## Run post deployment tests
8989
@echo "Post-deployment tests passed."
9090

9191
.PHONY: lint
92-
lint: check-golangci-lint ## Run lint
92+
lint: check-golangci-lint check-golangci-lint-version ## Run lint
9393
@printf "\033[33;1m==== Running linting ====\033[0m\n"
9494
golangci-lint run
9595

@@ -189,6 +189,14 @@ check-golangci-lint:
189189
@command -v golangci-lint >/dev/null 2>&1 || { \
190190
echo "❌ golangci-lint is not installed. Install from https://golangci-lint.run/docs/welcome/install/"; exit 1; }
191191

192+
.PHONY: check-golangci-lint-version
193+
check-golangci-lint-version:
194+
@version=$$(golangci-lint --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n 1); \
195+
if [[ $$version != 2.* ]]; then \
196+
echo "❌ golangci-lint version 2.x is required. Current version: $$version"; \
197+
exit 1; \
198+
fi
199+
192200
.PHONY: check-container-tool
193201
check-container-tool:
194202
@command -v $(CONTAINER_TOOL) >/dev/null 2>&1 || { \

0 commit comments

Comments
 (0)