From 0049df847d4e6cd27c3d934c14a6523cdbf23c99 Mon Sep 17 00:00:00 2001 From: Bazaah Date: Fri, 9 Dec 2022 16:26:22 +0000 Subject: [PATCH] tool/fmtck: gofmt err exit wrapper The go devs in their infinite wisdom have decided that extending gofmt / go fmt to error on exit is simply too complicated, so we have to script away their inadequacies for them. --- tool/fmtck.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 tool/fmtck.sh diff --git a/tool/fmtck.sh b/tool/fmtck.sh new file mode 100755 index 0000000..20b2134 --- /dev/null +++ b/tool/fmtck.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if test -n "$(gofmt -l "$@")"; +then + echo "[ERROR]: gofmt check errors" + gofmt -l "$@" | xargs -n1 printf ' > %s\n' + exit 1 +fi