#!/bin/sh
# script/fmt: format all Go code (writes). Formatting is the one gate that
# runs on the host rather than in docker.
set -eu

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

main() {
	cd "$ROOT"
	gofmt -s -w .
	if command -v goimports >/dev/null 2>&1; then
		goimports -w .
	fi
}

main "$@"
