#!/bin/sh
# script/fmt: format all files (writes). goimports runs with `go run` at
# a pinned commit, so nothing installs it and every machine formats with
# the same version.
set -eu

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

# goimports from golang.org/x/tools v0.51.0, 2026-10-02
GOIMPORTS="golang.org/x/tools/cmd/goimports@ea2f152dc35325e4b9b639583972375972350a84"

main() {
    cd "$ROOT"
    go run "$GOIMPORTS" -l -w .
}

main "$@"
