Skip to content

Commit a04d9a4

Browse files
authored
tests: improve golangci-lint local install and bump version (#4)
also minor polishing in Makefile
1 parent fbca90a commit a04d9a4

3 files changed

Lines changed: 26 additions & 11 deletions

File tree

.github/workflows/golangci-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ jobs:
2222
go-version: '1.24'
2323
cache: false
2424
- name: golangci-lint
25-
uses: golangci/golangci-lint-action@v7
25+
uses: golangci/golangci-lint-action@v8
2626
with:
2727
# Require: The version of golangci-lint to use.
2828
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
2929
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
30-
version: v2.1.1
30+
version: v2.5.0
3131

3232
# Optional: working directory, useful for monorepos
3333
# working-directory: somedir

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ go.work.sum
2525
.env
2626
/coverage
2727

28-
tools/ts
28+
.idea/
29+
30+
tools/

Makefile

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
tools/ts:
2-
# ts is a perl script. perl is installed on most linux systems, and in ubuntu Github runners.
3-
mkdir -p tools
4-
curl -L -o tools/ts https://github.com/pgdr/moreutils/raw/a87889a3bf06fb6be6022b14c152f2f7de608910/ts
5-
@echo "96a9504920a81570e0fc5df9c7a8be76b043261d9ed4a702af0238bdbe5ad5ea tools/ts" | sha256sum --check --strict
6-
chmod +x tools/ts
1+
.DEFAULT_GOAL := test
72

83
.PHONY: test
94
test: tools/ts
@@ -27,8 +22,8 @@ short-test:
2722

2823
#NB: CI uses the golangci-lint Github action, not this target
2924
.PHONY: lint
30-
lint:
31-
go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.5 run -v
25+
lint: tools/golangci-lint
26+
tools/golangci-lint run -v
3227

3328
.PHONY: checks
3429
checks: check_tidy check_vuln check_modern
@@ -49,3 +44,21 @@ check_modern:
4944
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@v0.20.0 ./...
5045
# non-zero exit status on issues found
5146
# nb: modernize is not part of golangci-lint yet - https://github.com/golangci/golangci-lint/issues/686
47+
48+
# Tools targets
49+
50+
tools:
51+
mkdir -p tools
52+
53+
tools/ts: tools
54+
# ts is a perl script. perl is installed on most linux systems, and in Ubuntu Github runners.
55+
curl -L -o tools/ts https://github.com/pgdr/moreutils/raw/a87889a3bf06fb6be6022b14c152f2f7de608910/ts
56+
@echo "96a9504920a81570e0fc5df9c7a8be76b043261d9ed4a702af0238bdbe5ad5ea tools/ts" | sha256sum --check --strict
57+
chmod +x tools/ts
58+
59+
tools/golangci-lint: tools
60+
# Version must be the same as in golangci-lint Github action
61+
# We install golangci-lint as recommended in the docs. See the same docs for a discussion about go run and
62+
# go get -tool alternatives - https://golangci-lint.run/docs/welcome/install/ .
63+
# Delete tools/golangci-lint if this target is updated (may be automated in the future)
64+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b ./tools v2.5.0

0 commit comments

Comments
 (0)