Catch error in gofmt (#2266)
This commit is contained in:
committed by
GitHub
parent
9357c2db0e
commit
288c843a17
5
Makefile
5
Makefile
@@ -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
12
verify-gofmt.sh
Executable 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
|
||||
Reference in New Issue
Block a user