Skip to content

Commit

Permalink
add a makefile (#11)
Browse files Browse the repository at this point in the history
I like the makefile since it hides a lot of the tooling options.
  • Loading branch information
jmrodri authored and dymurray committed Jun 1, 2018
1 parent 434765b commit 1ac4381
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
SOURCE_DIRS = cmd
SOURCES := $(shell find . -name '*.go' -not -path "*/vendor/*")
.DEFAULT_GOAL := sbcli

sbcli: $(SOURCES) ## Build the samplebroker
go build -i -ldflags="-s -w"

lint: ## Run golint
@golint -set_exit_status $(addsuffix /... , $(SOURCE_DIRS))

fmtcheck: ## Check go formatting
@gofmt -l $(SOURCES) | grep ".*\.go"; if [ "$$?" = "0" ]; then exit 1; fi

test: ## Run unit tests
@go test -cover ./cmd/...

vet: ## Run go vet
@go tool vet ./cmd

check: fmtcheck vet lint sbcli test ## Pre-flight checks before creating PR

clean: ## Clean up your working environment
@rm -f sbcli

help: ## Show this help screen
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
@echo ''
@echo 'Available targets are:'
@echo ''
@grep -E '^[ a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
@echo ''

.PHONY: clean lint build fmtcheck test vet help

0 comments on commit 1ac4381

Please sign in to comment.