Skip to content

Commit

Permalink
Makefile: Add fmt target to run go fmt over all non-vendor code
Browse files Browse the repository at this point in the history
Borrowed from libnetwork's Makefile

Signed-off-by: Euan Harris <[email protected]>
  • Loading branch information
euanh committed Dec 7, 2018
1 parent 5465bd2 commit 7dffc4c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,16 @@ lint:
@echo " -> $@"
@golint -set_exit_status ${PACKAGES}

fmt:
@echo " -> $@"
@test -z "$$(gofmt -s -l . | grep -v vendor/ | grep -v ".pb.go$$" | tee /dev/stderr)" || \
(echo "👹 please format Go code with 'gofmt -s -w'" && false)

cyclo:
@echo " -> $@"
@gocyclo -over 20 ${CYCLO_PACKAGES}

check: vet lint
check: vet lint fmt

test:
@go test -short -v -cover $(TEST_ARGS) ${PACKAGES}
Expand Down

0 comments on commit 7dffc4c

Please sign in to comment.