Catch error in gofmt (#2266)

This commit is contained in:
Cesar Celis Hernandez
2022-08-29 20:28:39 -04:00
committed by GitHub
parent 9357c2db0e
commit 288c843a17
2 changed files with 13 additions and 4 deletions

View File

@@ -28,10 +28,7 @@ verifiers: getdeps fmt lint
fmt:
@echo "Running $@ check"
@GO111MODULE=on gofmt -d restapi/
@GO111MODULE=on gofmt -d pkg/
@GO111MODULE=on gofmt -d cmd/
@GO111MODULE=on gofmt -d cluster/
@(env bash $(PWD)/verify-gofmt.sh)
crosscompile:
@(env bash $(PWD)/cross-compile.sh $(arg1))

12
verify-gofmt.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
# Expanding gofmt to cover more areas.
# This will include auto generated files created by Swagger.
# Catching the difference due to https://github.com/golang/go/issues/46289
DIFF=$(GO111MODULE=on gofmt -d .)
if [[ -n $DIFF ]];
then
echo "$DIFF";
echo "please run gofmt";
exit 1;
fi