Skip to content

Commit

Permalink
Update Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
markphelps committed Sep 21, 2018
1 parent 5b5e57f commit 7049ae4
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ GOTOOLS = \

.PHONY: setup
setup: ## Install all the build and lint dependencies
go get -u $(GOTOOLS)
@echo "--> Installing tools"
@go get -u $(GOTOOLS)

.PHONY: dep
dep: ## Install all import dependencies
dep ensure
@echo "--> Installing dependencies"
@dep ensure

.PHONY: test
test: ## Run all the tests
@echo "--> Running tests"
@echo 'mode: atomic' > coverage.txt && go list ./... | grep -v /vendor/ | xargs -n1 -I{} sh -c 'go test -covermode=atomic -coverprofile=coverage.txt -v -race -timeout=30s {}'

.PHONY: cover
Expand All @@ -21,22 +24,26 @@ cover: test ## Run all the tests and opens the coverage report

.PHONY: fmt
fmt: ## gofmt and goimports all go files
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
@echo "--> Running gofmt/goimports"
@find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done

.PHONY: lint
lint: ## Run all the linters
golangci-lint run
@echo "--> Running linters"
@golangci-lint run

.PHONY: ci
ci: lint test ## Run all the tests and code checks

.PHONY: generate
generate: ## Run go generate
go generate
@echo "--> Running go generate"
@go generate

.PHONY: build
build: ## Build
go build -o bin/optional ./cmd/optional/main.go
@echo "--> Building ..."
@go build -o bin/optional ./cmd/optional/main.go

# Absolutely awesome: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
Expand Down

0 comments on commit 7049ae4

Please sign in to comment.