Added contributing docs and Makefile for doing checks

This commit is contained in:
2025-10-09 12:27:21 +02:00
parent 83a029a694
commit bc35ff63e7
3 changed files with 143 additions and 0 deletions

33
Makefile Normal file
View 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