33 lines
		
	
	
		
			846 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			846 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
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
 |