-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I like the makefile since it hides a lot of the tooling options.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |