From 6b23ce1a623d4aa456c5cefdb386364503e49846 Mon Sep 17 00:00:00 2001 From: kwanhur Date: Wed, 26 Jan 2022 16:58:02 +0800 Subject: [PATCH] Feature pre-commit install with make - make deps add install pre-commit - make precommit supports to autoupdate and install hooks Signed-off-by: kwanhur --- Makefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Makefile b/Makefile index 809c39bb..f6757eab 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,8 @@ GOINSTALL := $(GO) install GOFLAGS := -race STATICCHECK := staticcheck LICENSEEYE := license-eye +PIP := pip3 +PIPINSTALL := $(PIP) install # init arch ARCH := $(shell getconf LONG_BIT) @@ -56,6 +58,12 @@ define INSTALL_PKG @echo $(1) installed endef +define PIP_INSTALL_PKG + @echo installing $(1) + $(PIPINSTALL) $(1) + @echo $(1) installed +endef + # make, make all all: prepare compile package @@ -99,10 +107,16 @@ package: # make deps deps: + $(call PIP_INSTALL_PKG, pre-commit) $(call INSTALL_PKG, goyacc, golang.org/x/tools/cmd/goyacc) $(call INSTALL_PKG, staticcheck, honnef.co/go/tools/cmd/staticcheck) $(call INSTALL_PKG, license-eye, github.com/apache/skywalking-eyes/cmd/license-eye@latest) +# make precommit, enable autoupdate and install with hooks +precommit: + pre-commit autoupdate + pre-commit install --install-hooks + # make check check: $(STATICCHECK) ./...