Added contributing docs and Makefile for doing checks
This commit is contained in:
33
Makefile
Normal file
33
Makefile
Normal file
@@ -0,0 +1,33 @@
|
||||
default: help
|
||||
|
||||
.PHONY: help
|
||||
help: ## show this help
|
||||
@echo 'usage: make [target] ...'
|
||||
@echo ''
|
||||
@echo 'targets:'
|
||||
@egrep '^(.+)\:\ .*##\ (.+)' ${MAKEFILE_LIST} | sed 's/:.*##/#/' | column -t -c 2 -s '#'
|
||||
|
||||
.PHONY: check
|
||||
check: check-format test lint ## run all code checks
|
||||
|
||||
.PHONY: lint
|
||||
lint: ## lint the code with golangci-lint
|
||||
golangci-lint run
|
||||
|
||||
.PHONY: test
|
||||
test: ## test the code with go test
|
||||
go test -v ./...
|
||||
|
||||
.PHONY: format
|
||||
format: ## format the code with goimports and tidy the go modules
|
||||
go mod tidy -v
|
||||
goimports -local git.maze.io/go/dpi -w *.go */*.go
|
||||
|
||||
.PHONY: check-format
|
||||
check-format: ## check if the the code formatting and modules
|
||||
go mod tidy -diff
|
||||
goimports -local git.maze.io/go/dpi -l -w *.go */*.go
|
||||
|
||||
.PHONY: tools
|
||||
tools: ## fetch and install all required tools
|
||||
go get -v -u golang.org/x/tools/cmd/goimports@latest
|
Reference in New Issue
Block a user