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
|
|
|
|
2022-10-30 19:02:26 +00:00
|
|
|
export PATH="$(bazel info output_base)/external/go_sdk/bin:$PATH"
|
2022-10-30 05:03:06 +00:00
|
|
|
|
2022-10-30 20:04:20 +00:00
|
|
|
$(go fmt -n $(go list ./... | grep -v /vendor/) | sed 's/ -w//') > /tmp/fmt
|
|
|
|
|
|
|
|
if [[ -n "$(cat /tmp/fmt)" ]]; then
|
2022-10-30 05:03:06 +00:00
|
|
|
echo "Go files must be formatted with gofmt. Please run:"
|
2022-10-30 19:02:26 +00:00
|
|
|
echo ' go fmt $(go list ./... | grep -v /vendor/)'
|
2022-10-30 05:03:06 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|