diff options
author | Haoping Ku <haoping.ku@dexon.org> | 2018-07-25 11:13:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-25 11:13:34 +0800 |
commit | 7a60cb62e1d1b90f5a61f384acf1f19a413d4a10 (patch) | |
tree | 4bb0bfe731852fc69c126ab1a42f7a1925703e03 | |
parent | 6da90b5e47f7f7f3a2219f34b2bde580b7ed7438 (diff) | |
download | dexon-consensus-7a60cb62e1d1b90f5a61f384acf1f19a413d4a10.tar dexon-consensus-7a60cb62e1d1b90f5a61f384acf1f19a413d4a10.tar.gz dexon-consensus-7a60cb62e1d1b90f5a61f384acf1f19a413d4a10.tar.bz2 dexon-consensus-7a60cb62e1d1b90f5a61f384acf1f19a413d4a10.tar.lz dexon-consensus-7a60cb62e1d1b90f5a61f384acf1f19a413d4a10.tar.xz dexon-consensus-7a60cb62e1d1b90f5a61f384acf1f19a413d4a10.tar.zst dexon-consensus-7a60cb62e1d1b90f5a61f384acf1f19a413d4a10.zip |
Add make format (#12)
Added rule "format" and "check-format" in GNUmakefile.
-rw-r--r-- | .circleci/config.yml | 1 | ||||
-rw-r--r-- | GNUmakefile | 12 |
2 files changed, 12 insertions, 1 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index 390f5ba..d0d618d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,6 +11,7 @@ jobs: steps: - checkout - run: bin/install_tools.sh + - run: make check-format - run: dep ensure - run: make lint - run: make vet diff --git a/GNUmakefile b/GNUmakefile index 1cac341..85307e6 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -52,7 +52,10 @@ $(foreach component, $(COMPONENTS), $(eval $(call BUILD_RULE,$(component)))) pre-build: -pre-submit: lint test vet +pre-submit: check-format lint test vet + +format: + @go fmt `go list ./... | grep -v 'vendor'` lint: @$(GOPATH)/bin/golint -set_exit_status `go list ./... | grep -v 'vendor'` @@ -67,3 +70,10 @@ test: exit 1; \ fi; \ done + +check-format: + @if gofmt -l `go list -f '{{.Dir}}' ./...` | grep -q go; then \ + echo 'Error: source code not formatted'; \ + exit 1; \ + fi + |