Skip to content

Commit b5bee73

Browse files
committed
Use .tool-versions file for global setting of golangcilint version
1 parent ee88c38 commit b5bee73

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
- name: Run golangci-lint
2727
uses: golangci/golangci-lint-action@v7
2828
with:
29-
version: v2.8.0
29+
version-file: .tool-versions

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
golangci-lint 2.8.0

Makefile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,9 @@ test-integration: build
1717

1818
mock-generate:
1919
go generate ./...
20-
GOLANGCI_LINT_VERSION := 2.8.0
2120

2221
lint:
23-
@which golangci-lint > /dev/null || (echo "golangci-lint not found." && exit 1)
24-
@INSTALLED=$$(golangci-lint version --short | sed 's/^v//'); \
25-
if [ "$$INSTALLED" != "$(GOLANGCI_LINT_VERSION)" ]; then \
26-
echo "golangci-lint version mismatch: installed $$INSTALLED, expected $(GOLANGCI_LINT_VERSION)"; \
27-
exit 1; \
28-
fi
22+
@EXPECTED=$$(awk '/^golangci-lint/ {print $$2}' .tool-versions); \
23+
INSTALLED=$$(golangci-lint version --short 2>/dev/null | sed 's/^v//'); \
24+
[ "$$INSTALLED" = "$$EXPECTED" ] || { echo "golangci-lint $$EXPECTED required (found: $$INSTALLED)"; exit 1; }
2925
golangci-lint run

0 commit comments

Comments
 (0)