Skip to content

Commit

Permalink
Add generate, mod-tidy and diff make targets
Browse files Browse the repository at this point in the history
  • Loading branch information
pellared committed Jun 8, 2020
1 parent 1ad2679 commit 654ad8d
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)"
Expand Down

0 comments on commit 654ad8d

Please sign in to comment.