Merge pull request #47 from mstg/fix-2-gofmt

Output go fmt results to temp file and check if empty
This commit is contained in:
resf-prow[bot] 2022-10-30 20:11:07 +00:00 committed by GitHub
commit 115bc2df5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,9 @@ $BAZEL_B @go_sdk//...
export PATH="$(bazel info output_base)/external/go_sdk/bin:$PATH"
if [[ -z $(go fmt -n $(go list ./... | grep -v /vendor/) | sed 's/ -w//') ]]; then
$(go fmt -n $(go list ./... | grep -v /vendor/) | sed 's/ -w//') > /tmp/fmt
if [[ -n "$(cat /tmp/fmt)" ]]; then
echo "Go files must be formatted with gofmt. Please run:"
echo ' go fmt $(go list ./... | grep -v /vendor/)'
exit 1