From 44c9736535d6209fa02c6afbb2652806893e85c3 Mon Sep 17 00:00:00 2001 From: Dan Jones Date: Sat, 3 Feb 2024 17:14:37 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20Always=20fmt=20before=20test=20o?= =?UTF-8?q?r=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9fb50c4..35491dc 100644 --- a/Makefile +++ b/Makefile @@ -15,15 +15,15 @@ clean: ## Removes temporary and build files rm -v $(COVEROUT) $(COVERHTML) $(OUT) || true .PHONY: fmt ## Runs go fmt -fmt: ## Runs go fmt +fmt: $(SOURCES) ## Runs go fmt go fmt ./... .PHONY: test test: ## Test application and generate coverage report - rm $(COVEROUT) 2>/dev/null || true + $(MAKE) clean $(MAKE) $(COVEROUT) -$(COVEROUT): $(SOURCES) +$(COVEROUT): $(SOURCES) fmt go test ./... -race -cover -coverprofile $@ $(COVERHTML): $(COVEROUT) @@ -39,5 +39,5 @@ open-report: report ## Open the coverage report in the default browser .PHONY: build build: $(OUT) ## Builds the application -$(OUT): $(SOURCES) +$(OUT): $(SOURCES) fmt go build -o $@