Skip to content

Commit

Permalink
feat: Extend Makefile for more source code quality targets
Browse files Browse the repository at this point in the history
The Makefile contains now additional commands to support
during development and aim for a higher source code quality:

- go vet
- go fmt
- same unit tests run command like travis
- static analysis
- and a target to run all together
  • Loading branch information
andygrunwald authored and ghostsquad committed Apr 29, 2020
1 parent 72d53e4 commit 5e52236
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
test:
go test -v ./...
.DEFAULT_GOAL := help

.PHONY: help
help: ## Outputs the help.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: test
test: ## Runs all unit, integration and example tests.
go test -race -v ./...

.PHONY: vet
vet: ## Runs go vet (to detect suspicious constructs).
go vet ./...

.PHONY: fmt
fmt: ## Runs go fmt (to check for go coding guidelines).
gofmt -d -s .

.PHONY: staticcheck
staticcheck: ## Runs static analysis to prevend bugs, foster code simplicity, performance and editor integration.
go get -u honnef.co/go/tools/cmd/staticcheck
staticcheck ./...

.PHONY: all
all: test vet fmt staticcheck ## Runs all source code quality targets (like test, vet, fmt, staticcheck)

0 comments on commit 5e52236

Please sign in to comment.