diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 9242964..40bde82 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -22,12 +22,12 @@ jobs: go-version: '1.24' cache: false - name: golangci-lint - uses: golangci/golangci-lint-action@v7 + uses: golangci/golangci-lint-action@v8 with: # Require: The version of golangci-lint to use. # When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. # When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. - version: v2.1.1 + version: v2.5.0 # Optional: working directory, useful for monorepos # working-directory: somedir diff --git a/.gitignore b/.gitignore index 53af89e..189eab6 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,6 @@ go.work.sum .env /coverage -tools/ts +.idea/ + +tools/ diff --git a/Makefile b/Makefile index 23c9e77..f08a8b0 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,4 @@ -tools/ts: -# ts is a perl script. perl is installed on most linux systems, and in ubuntu Github runners. - mkdir -p tools - curl -L -o tools/ts https://github.com/pgdr/moreutils/raw/a87889a3bf06fb6be6022b14c152f2f7de608910/ts - @echo "96a9504920a81570e0fc5df9c7a8be76b043261d9ed4a702af0238bdbe5ad5ea tools/ts" | sha256sum --check --strict - chmod +x tools/ts +.DEFAULT_GOAL := test .PHONY: test test: tools/ts @@ -27,8 +22,8 @@ short-test: #NB: CI uses the golangci-lint Github action, not this target .PHONY: lint -lint: - go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.5 run -v +lint: tools/golangci-lint + tools/golangci-lint run -v .PHONY: checks checks: check_tidy check_vuln check_modern @@ -49,3 +44,21 @@ check_modern: go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@v0.20.0 ./... # non-zero exit status on issues found # nb: modernize is not part of golangci-lint yet - https://github.com/golangci/golangci-lint/issues/686 + +# Tools targets + +tools: + mkdir -p tools + +tools/ts: tools +# ts is a perl script. perl is installed on most linux systems, and in Ubuntu Github runners. + curl -L -o tools/ts https://github.com/pgdr/moreutils/raw/a87889a3bf06fb6be6022b14c152f2f7de608910/ts + @echo "96a9504920a81570e0fc5df9c7a8be76b043261d9ed4a702af0238bdbe5ad5ea tools/ts" | sha256sum --check --strict + chmod +x tools/ts + +tools/golangci-lint: tools +# Version must be the same as in golangci-lint Github action +# We install golangci-lint as recommended in the docs. See the same docs for a discussion about go run and +# go get -tool alternatives - https://golangci-lint.run/docs/welcome/install/ . +# Delete tools/golangci-lint if this target is updated (may be automated in the future) + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b ./tools v2.5.0