aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.circleci/config.yml1
-rw-r--r--GNUmakefile12
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
+