github.com/oam-dev/kubevela@v1.9.11/makefiles/dependency.mk (about) 1 2 GOLANGCILINT_VERSION ?= 1.49.0 3 GLOBAL_GOLANGCILINT := $(shell which golangci-lint) 4 GOBIN_GOLANGCILINT:= $(shell which $(GOBIN)/golangci-lint) 5 6 .PHONY: golangci 7 golangci: 8 ifeq ($(shell $(GLOBAL_GOLANGCILINT) version --format short), $(GOLANGCILINT_VERSION)) 9 @$(OK) golangci-lint is already installed 10 GOLANGCILINT=$(GLOBAL_GOLANGCILINT) 11 else ifeq ($(shell $(GOBIN_GOLANGCILINT) version --format short), $(GOLANGCILINT_VERSION)) 12 @$(OK) golangci-lint is already installed 13 GOLANGCILINT=$(GOBIN_GOLANGCILINT) 14 else 15 @{ \ 16 set -e ;\ 17 echo 'installing golangci-lint-$(GOLANGCILINT_VERSION)' ;\ 18 curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v$(GOLANGCILINT_VERSION) ;\ 19 echo 'Successfully installed' ;\ 20 } 21 GOLANGCILINT=$(GOBIN)/golangci-lint 22 endif 23 24 .PHONY: staticchecktool 25 staticchecktool: 26 ifeq (, $(shell which staticcheck)) 27 @{ \ 28 set -e ;\ 29 echo 'installing honnef.co/go/tools/cmd/staticcheck ' ;\ 30 go install honnef.co/go/tools/cmd/staticcheck@d7e217c1ff411395475b2971c0824e1e7cc1af98 ;\ 31 } 32 STATICCHECK=$(GOBIN)/staticcheck 33 else 34 STATICCHECK=$(shell which staticcheck) 35 endif 36 37 .PHONY: goimports 38 goimports: 39 ifeq (, $(shell which goimports)) 40 @{ \ 41 set -e ;\ 42 go install golang.org/x/tools/cmd/goimports@6546d82b229aa5bd9ebcc38b09587462e34b48b6 ;\ 43 } 44 GOIMPORTS=$(GOBIN)/goimports 45 else 46 GOIMPORTS=$(shell which goimports) 47 endif 48 49 CUE_VERSION ?= v0.6.0 50 .PHONY: installcue 51 installcue: 52 ifeq (, $(shell which cue)) 53 @{ \ 54 set -e ;\ 55 go install cuelang.org/go/cmd/cue@$(CUE_VERSION) ;\ 56 } 57 CUE=$(GOBIN)/cue 58 else 59 CUE=$(shell which cue) 60 endif 61 62 KUSTOMIZE_VERSION ?= 4.5.4 63 KUSTOMIZE = $(shell pwd)/bin/kustomize 64 .PHONY: kustomize 65 kustomize: 66 ifneq (, $(shell kustomize version | grep $(KUSTOMIZE_VERSION))) 67 KUSTOMIZE=$(shell which kustomize) 68 else ifneq (, $(shell $(KUSTOMIZE) version | grep $(KUSTOMIZE_VERSION))) 69 else 70 @{ \ 71 set -eo pipefail ;\ 72 echo "installing kustomize-v$(KUSTOMIZE_VERSION) into $(shell pwd)/bin" ;\ 73 mkdir -p $(shell pwd)/bin ;\ 74 rm -f $(KUSTOMIZE) ;\ 75 curl -sS https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh | bash -s $(KUSTOMIZE_VERSION) $(shell pwd)/bin;\ 76 echo 'Install succeed' ;\ 77 } 78 endif 79 80 .PHONY: helmdoc 81 helmdoc: 82 ifeq (, $(shell which readme-generator)) 83 @{ \ 84 set -e ;\ 85 echo 'installing readme-generator-for-helm' ;\ 86 npm install -g @bitnami/readme-generator-for-helm ;\ 87 } 88 else 89 @$(OK) readme-generator-for-helm is already installed 90 HELMDOC=$(shell which readme-generator) 91 endif