about summary refs log tree commit diff stats
path: root/Makefile
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2021-12-11 22:03:25 +0100
committerRobin Jarry <robin@jarry.cc>2021-12-11 23:13:27 +0100
commit6857ab7a71d118b6ed85087e0977b9037c1540a2 (patch)
tree7115cee22c0016e12dd9e2d9c21593e7f7d885ae /Makefile
parent0ef72dd5754fd37d12e67120ee4624454e507ea4 (diff)
downloadaerc-6857ab7a71d118b6ed85087e0977b9037c1540a2.tar.gz
build: add check for code formatting
Let's avoid pushing unformatted code.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 12 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index c481976..d352fbe 100644
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,18 @@ aerc: $(GOSRC)
 		-X main.Version=$(VERSION)" \
 		-o $@
 
+.PHONY: fmt
+fmt:
+	gofmt -w .
+
+.PHONY: checkfmt
+checkfmt:
+	@if [ `gofmt -l . | wc -l` -ne 0 ]; then \
+		gofmt -d .; \
+		echo "ERROR: source files need reformatting with gofmt"; \
+		exit 1; \
+	fi
+
 aerc.conf: config/aerc.conf.in
 	sed -e 's:@SHAREDIR@:$(SHAREDIR):g' > $@ < config/aerc.conf.in