#!/bin/sh # script/fmt-check: check formatting (read-only). Same scope as # script/fmt, but fails instead of writing. set -eu SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)" ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)" main() { cd "$ROOT" if [ -n "$(gofmt -s -l .)" ]; then echo "gofmt needed on:" gofmt -s -l . exit 1 fi # Exit 2 means no prettier and no docker: reported by # script/prettier on stderr and not treated as a failure, so this # check still runs on a machine that has neither. The container # build is the gate that always has both. "$SCRIPT_DIR/prettier" --check . || [ $? -eq 2 ] } main "$@"