diff --git a/.circleci/config.yml b/.circleci/config.yml index 23a410e940..c13f2e64e1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -202,10 +202,11 @@ jobs: make gen-serialized if [[ -n $(git status --porcelain) ]]; then echo "Please update the serialized files using 'make gen-serialized'"; exit 1; fi - # Dedicate job for golangci-lint it does not need anything only the server code for that + # Dedicated job for golangci-lint it does not need anything only the server code for that # and to make more clear when the job fails check-golangci-lint: docker: + # Keep the version in sync with the command in Makefile - image: golangci/golangci-lint:v1.39.0 steps: - checkout diff --git a/Makefile b/Makefile index 7eaeaf0c5d..a98cf9496f 100644 --- a/Makefile +++ b/Makefile @@ -243,17 +243,14 @@ else endif golangci-lint: ## Run golangci-lint on codebase -# https://stackoverflow.com/a/677212/1027058 (check if a command exists or not) - @if ! [ -x "$$(command -v golangci-lint)" ]; then \ - echo "golangci-lint is not installed. Please see https://github.com/golangci/golangci-lint#install for installation instructions."; \ - exit 1; \ - fi; \ + @# Keep the version in sync with the command in .circleci/config.yml + $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.39.0 @echo Running golangci-lint - golangci-lint run ./... + $(GOBIN)/golangci-lint run ./... ifeq ($(BUILD_ENTERPRISE_READY),true) ifneq ($(MM_NO_ENTERPRISE_LINT),true) - golangci-lint run ./enterprise/... + $(GOBIN)/golangci-lint run ./enterprise/... endif endif