From 8a9df2dd3993df5716a4e5fe6622ee69efc0a876 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 15 Nov 2021 16:39:54 +0800 Subject: [PATCH] Fix: stop installing golangci-lint each time (#2713) When golangci-lint doesn't locate in $PATH, it will be installed in $GOBIN every single time. (cherry picked from commit bff846b7fe4e7a442a00bbbcafd3d01da8456025) Co-authored-by: zzxwill --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3452a66d9..2f01a71b4 100644 --- a/Makefile +++ b/Makefile @@ -275,16 +275,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