Skip to content

Commit 288c843

Browse files
authored
Catch error in gofmt (#2266)
1 parent 9357c2d commit 288c843

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ verifiers: getdeps fmt lint
2828

2929
fmt:
3030
@echo "Running $@ check"
31-
@GO111MODULE=on gofmt -d restapi/
32-
@GO111MODULE=on gofmt -d pkg/
33-
@GO111MODULE=on gofmt -d cmd/
34-
@GO111MODULE=on gofmt -d cluster/
31+
@(env bash $(PWD)/verify-gofmt.sh)
3532

3633
crosscompile:
3734
@(env bash $(PWD)/cross-compile.sh $(arg1))

verify-gofmt.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# Expanding gofmt to cover more areas.
4+
# This will include auto generated files created by Swagger.
5+
# Catching the difference due to https://github.com/golang/go/issues/46289
6+
DIFF=$(GO111MODULE=on gofmt -d .)
7+
if [[ -n $DIFF ]];
8+
then
9+
echo "$DIFF";
10+
echo "please run gofmt";
11+
exit 1;
12+
fi

0 commit comments

Comments
 (0)