#!/bin/sh # script/fmt-check: check formatting (read-only). Fails and lists the # offending files if gofmt would reformat anything. set -eu ROOT="$(cd "$(dirname "$0")/.." && pwd -P)" main() { cd "$ROOT" unformatted="$(gofmt -l .)" if [ -n "$unformatted" ]; then echo "gofmt would reformat:" echo "$unformatted" exit 1 fi } main "$@"