From 3df47d74f1937afa78a6241b1e168de51dd35118 Mon Sep 17 00:00:00 2001 From: Zheng Xi Zhou Date: Mon, 15 Nov 2021 15:02:48 +0800 Subject: [PATCH] Fix: stop installing golangci-lint each time (#2712) When golangci-lint doesn't locate in $PATH, it will be installed in $GOBIN every single time. --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6c605db70..e5451a06a 100644 --- a/Makefile +++ b/Makefile @@ -284,16 +284,20 @@ HOSTARCH := amd64 endif golangci: -ifeq (, $(shell which golangci-lint)) +ifneq ($(shell which golangci-lint),) + @$(OK) golangci-lint is already installed +GOLANGCILINT=$(shell which golangci-lint) +else ifeq (, $(shell which $(GOBIN)/golangci-lint)) @{ \ set -e ;\ echo 'installing golangci-lint-$(GOLANGCILINT_VERSION)' ;\ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) $(GOLANGCILINT_VERSION) ;\ - echo 'Install succeed' ;\ + echo 'Successfully installed' ;\ } GOLANGCILINT=$(GOBIN)/golangci-lint else -GOLANGCILINT=$(shell which golangci-lint) + @$(OK) golangci-lint is already installed +GOLANGCILINT=$(GOBIN)/golangci-lint endif .PHONY: staticchecktool