diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index cb41461c88f5..fe7226e9bbb4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,4 +23,4 @@ jobs: uses: golangci/golangci-lint-action@v3 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: latest + version: v1.49.0 diff --git a/Makefile b/Makefile index edad5f41cf3c..93899a4e7026 100644 --- a/Makefile +++ b/Makefile @@ -341,28 +341,24 @@ benchmark: ### Linting ### ############################################################################### -markdownLintImage=tmknom/markdownlint -containerMarkdownLint=$(PROJECT_NAME)-markdownlint -containerMarkdownLintFix=$(PROJECT_NAME)-markdownlint-fix - golangci_lint_cmd=golangci-lint +golangci_version=v1.49.0 -lint: lint-go - @if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerMarkdownLint}$$"; then docker start -a $(containerMarkdownLint); else docker run --name $(containerMarkdownLint) -i -v "$(CURDIR):/work" $(markdownLintImage); fi +lint: + @echo "--> Running linter" + @go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version) + @$(golangci_lint_cmd) run --timeout=10m lint-fix: - golangci-lint run --fix --out-format=tab --issues-exit-code=0 - @if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerMarkdownLintFix}$$"; then docker start -a $(containerMarkdownLintFix); else docker run --name $(containerMarkdownLintFix) -i -v "$(CURDIR):/work" $(markdownLintImage) . --fix; fi - -lint-go: - @@test -n "$$golangci-lint version | awk '$4 >= 1.42')" - $(golangci_lint_cmd) run --out-format=tab $(GIT_DIFF) + @echo "--> Running linter" + @go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version) + @$(golangci_lint_cmd) run --fix --out-format=tab --issues-exit-code=0 .PHONY: lint lint-fix format: @go install mvdan.cc/gofumpt@latest - @go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + @go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version) find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -path "./tests/mocks/*" -not -name "*.pb.go" -not -name "*.pb.gw.go" -not -name "*.pulsar.go" -not -path "./crypto/keys/secp256k1/*" | xargs gofumpt -w -l golangci-lint run --fix .PHONY: format