peridot/hack/gofmt_check.sh

18 lines
363 B
Bash
Raw Normal View History

2022-10-30 05:03:06 +00:00
#!/usr/bin/env bash
set -o errexit
2022-10-30 05:18:12 +00:00
source hack/bazel_setup.sh
$BAZEL_B @go_sdk//...
2022-10-30 05:03:06 +00:00
GO_BIN="$(bazel info output_base)/external/go_sdk/bin/go"
if [[ -n $($GO_BIN fmt -n $(go list ./... | grep -v /vendor/) | sed 's/ -w//') ]]; then
echo "Go files must be formatted with gofmt. Please run:"
echo " go fmt $(go list ./... | grep -v /vendor/)"
exit 1
fi