Skip to content

Commit

Permalink
Makefile: fix format error reporting
Browse files Browse the repository at this point in the history
"go fmt" always fixes code in place. As a result, running it again to
report formatting errors doesn't do anything.

The original intention probably was to check for errors and then
report them. This is what is done now, using gofmt directly and
it's diff output mode.
  • Loading branch information
pohly committed Jul 20, 2018
1 parent 1a22b17 commit 275a086
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ push: container
docker push $(IMAGE_NAME):$(IMAGE_VERSION)

test:
if ! [ $$(go fmt $$(go list ./... | grep -v vendor) | wc -l) -eq 0 ]; then \
echo "formatting errors:"; \
go fmt $$(go list ./... | grep -v vendor); \
false; \
fi
files=$$(find ./ -name '*.go' | grep -v '^./vendor' ); \
if [ $$(gofmt -d $$files | wc -l) -ne 0 ]; then \
echo "formatting errors:"; \
gofmt -d $$files; \
false; \
fi
go vet $$(go list ./... | grep -v vendor)
go test $$(go list ./... | grep -v vendor | grep -v "cmd/csi-sanity")
./hack/e2e.sh
Expand Down

0 comments on commit 275a086

Please sign in to comment.