#!/bin/sh
# script/fmt-check-go: check Go formatting (read-only). Split out from
# script/fmt-check so the Docker lint stage, whose image has no node and
# therefore no prettier, can run the Go half on its own.
set -eu

ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"

main() {
    cd "$ROOT"
    if [ -n "$(gofmt -l .)" ]; then
        echo "gofmt: files need formatting:" >&2
        gofmt -l . >&2
        exit 1
    fi
}

main "$@"
