Skip to content

Commit

Permalink
Feature pre-commit install with make
Browse files Browse the repository at this point in the history
- make deps add install pre-commit
- make precommit supports to autoupdate and install hooks

Signed-off-by: kwanhur <huang_hua2012@163.com>
  • Loading branch information
kwanhur committed Jan 27, 2022
1 parent ef31e02 commit 6b23ce1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down Expand Up @@ -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) ./...
Expand Down

0 comments on commit 6b23ce1

Please sign in to comment.