From 333caaae75eaf61b81ef93b2652a65bec5c5135a Mon Sep 17 00:00:00 2001 From: Philip O Toole Date: Mon, 14 Mar 2016 21:51:27 -0700 Subject: [PATCH] Add script to check 'go fmt' status --- gofmt.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 gofmt.sh diff --git a/gofmt.sh b/gofmt.sh new file mode 100755 index 00000000..e4ae4bd9 --- /dev/null +++ b/gofmt.sh @@ -0,0 +1,6 @@ +#!/bin/bash +fmtcount=`git ls-files | grep '.go$' | xargs gofmt -l 2>&1 | wc -l` +if [ $fmtcount -gt 0 ]; then + echo "run 'go fmt ./...' to format your source code." + exit 1 +fi