Skip to content

Commit

Permalink
Remove incorrect Makefile conditionals (LeanerCloud#418)
Browse files Browse the repository at this point in the history
`ifeq` and similar Makefile constructs run _before_ target invocation.
This means that `go vet` and `gofmt` were being run when targets
like `make help` were run.

FWIW, I don't think the extra code added much over simply invoking
`go vet` and `gofmt`. Their output is already very good.
  • Loading branch information
gabegorelick committed Feb 10, 2020
1 parent 985d675 commit a01ee26
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,26 +70,12 @@ upload: archive ## Upload binary
aws s3 sync build/s3/ s3://$(BUCKET_NAME)/
.PHONY: upload

vet-check: build_deps ## Verify vet compliance
ifeq ($(shell go vet -all . | wc -l | tr -d '[:space:]'), 0)
@printf "ok\tall files passed go vet\n"
else
@printf "error\tsome files did not pass go vet\n"
@go vet -all . 2>&1
@exit 1
endif

vet-check: ## Verify vet compliance
@go vet -all ./...
.PHONY: vet-check

fmt-check: build_deps ## Verify fmt compliance
ifeq ($(shell gofmt -l -s . | wc -l | tr -d '[:space:]'), 0)
@printf "ok\tall files passed go fmt\n"
else
@printf "error\tsome files did not pass go fmt, fix the following formatting diff:\n"
fmt-check: ## Verify fmt compliance
@gofmt -l -s -d .
@exit 1
endif

.PHONY: fmt-check

test: ## Test go code and coverage
Expand Down

0 comments on commit a01ee26

Please sign in to comment.