From 654ad8daee970b23c47d5fa2732d52796d650a43 Mon Sep 17 00:00:00 2001 From: Robert Pajak Date: Mon, 8 Jun 2020 20:27:48 +0200 Subject: [PATCH] Add generate, mod-tidy and diff make targets --- Makefile | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 73a1664..7b3bd3e 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ .PHONY: all all: ## full build -all: install build fmt lint test release +all: install generate build mod-tidy fmt lint test release diff .PHONY: dev dev: ## fast build @@ -18,15 +18,28 @@ install: ## install build tools $(call print-target) ./install.sh +.PHONY: generate +generate: ## go generate + $(call print-target) + go generate ./... + .PHONY: build build: ## go build $(call print-target) go build ./... +.PHONY: mod-tidy +mod-tidy: ## go mod tidy + $(call print-target) + go mod tidy + git diff --exit-code -- go.mod go.sum + .PHONY: fmt fmt: ## goimports $(call print-target) - goimports -l -w . + @# ignore the goimports exit code as the generated code may be reformated + goimports -l -w . || true + git diff --exit-code .PHONY: lint lint: ## golangci-lint @@ -48,6 +61,11 @@ release: ## goreleaser --snapshot --skip-publish --rm-dist $(call print-target) goreleaser --snapshot --skip-publish --rm-dist +.PHONY: diff +diff: ## git diff + $(call print-target) + git diff --exit-code + .PHONY: docker docker: ## run in golang container, example: make docker run="make all" docker run --rm -v $(CURDIR):/app $(args) golang:1.14 sh -c "cd /app && $(run)"