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) ./...