summaryrefslogtreecommitdiff
path: root/travis/run-gofmt
diff options
context:
space:
mode:
authorAlvaro Saurin <alvaro.saurin@gmail.com>2017-10-19 17:39:31 +0200
committerAlvaro <alvaro.saurin@gmail.com>2017-11-27 13:04:37 +0100
commitc7cc7221d46e8fa7ee7d64c7eab64f5515980fc1 (patch)
tree94f923062c9ff708b7f5c80621a6f6634befd0b2 /travis/run-gofmt
parent39b7567db8477cebf98ca7ff225c2a356b42bd98 (diff)
downloadterraform-provider-libvirt-c7cc7221d46e8fa7ee7d64c7eab64f5515980fc1.tar
terraform-provider-libvirt-c7cc7221d46e8fa7ee7d64c7eab64f5515980fc1.tar.gz
Simplify the wait_for_leases mechanism
Diffstat (limited to 'travis/run-gofmt')
-rwxr-xr-xtravis/run-gofmt30
1 files changed, 30 insertions, 0 deletions
diff --git a/travis/run-gofmt b/travis/run-gofmt
new file mode 100755
index 00000000..d7d7aef6
--- /dev/null
+++ b/travis/run-gofmt
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+set -e
+GOPKG="libvirt"
+
+lint_pkg () {
+ cd $1
+ echo "*** checking pkg $1 with gofmt"
+ if [ -n "$(go fmt ./...)" ]; then
+ echo "Go code on pkg $1 is not formatted well, run 'go fmt on pkg $1'"
+ exit 1
+ fi
+ echo " pkg $1 has no lint gofmt errors!"
+ cd ..
+}
+
+lint_main () {
+ echo '*** running gofmt on main.go'
+ if [ -n "$(go fmt main.go)" ]; then
+ echo "Go code on main.go is not formatted, please run 'go fmt main.go'"
+ exit 1
+ fi
+}
+
+echo "==> Checking that code complies with gofmt requirements..."
+lint_pkg $GOPKG
+echo
+lint_main
+echo '==> go fmt OK !!! ***'
+exit 0