mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-11-21 12:41:27 +00:00
Output go fmt results to temp file and check if empty
This commit is contained in:
parent
7facaddd48
commit
dbfd3918d3
@ -8,7 +8,9 @@ $BAZEL_B @go_sdk//...
|
|||||||
|
|
||||||
export PATH="$(bazel info output_base)/external/go_sdk/bin:$PATH"
|
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 files must be formatted with gofmt. Please run:"
|
||||||
echo ' go fmt $(go list ./... | grep -v /vendor/)'
|
echo ' go fmt $(go list ./... | grep -v /vendor/)'
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user