Skip to content

Commit bd0d2ce

Browse files
committed
Use .tool-versions file for global setting of golangcilint version
1 parent 0c8d564 commit bd0d2ce

3 files changed

Lines changed: 5 additions & 9 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 & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,8 @@ clean:
1212
test-integration: build
1313
cd test/integration && go test -count=1 -v .
1414

15-
GOLANGCI_LINT_VERSION := 2.8.0
16-
1715
lint:
18-
@which golangci-lint > /dev/null || (echo "golangci-lint not found." && exit 1)
19-
@INSTALLED=$$(golangci-lint version --short | sed 's/^v//'); \
20-
if [ "$$INSTALLED" != "$(GOLANGCI_LINT_VERSION)" ]; then \
21-
echo "golangci-lint version mismatch: installed $$INSTALLED, expected $(GOLANGCI_LINT_VERSION)"; \
22-
exit 1; \
23-
fi
16+
@EXPECTED=$$(awk '/^golangci-lint/ {print $$2}' .tool-versions); \
17+
INSTALLED=$$(golangci-lint version --short 2>/dev/null | sed 's/^v//'); \
18+
[ "$$INSTALLED" = "$$EXPECTED" ] || { echo "golangci-lint $$EXPECTED required (found: $$INSTALLED)"; exit 1; }
2419
golangci-lint run

0 commit comments

Comments
 (0)