| 1 |
.PHONY: install-tools lint test test-verbose format help compile-constants |
| 2 |
.SILENT: install-tools lint test test-verbose format help compile-constants |
| 3 |
|
| 4 |
help: |
| 5 |
grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
| 6 |
|
| 7 |
install-tools: ## Install linting tools |
| 8 |
go install github.com/golangci/golangci-lint/cmd/[email protected] |
| 9 |
go install mvdan.cc/[email protected] |
| 10 |
go install github.com/segmentio/golines@latest |
| 11 |
|
| 12 |
lint: ## Run golangci linter |
| 13 |
golangci-lint run -c ./golangci.yml ./... |
| 14 |
|
| 15 |
format: ## Format code |
| 16 |
gofumpt -l -w -extra . |
| 17 |
golines . -w |
| 18 |
|
| 19 |
test: ## Run tests |
| 20 |
go test -test.timeout 120s -count=1 . |
| 21 |
go test -test.timeout 120s -count=1 ./ciinfo/ |
| 22 |
|
| 23 |
test-verbose: ## Run tests with verbose output |
| 24 |
go test -test.timeout 120s -v -cover -count=1 . |
| 25 |
go test -test.timeout 120s -v -cover -count=1 ./ciinfo/ |
| 26 |
|
| 27 |
compile-constants: ## Generates 'constants.go' containing the list with constant values |
| 28 |
cp vendors.go compile-constants |
| 29 |
$(shell if [ "$$(uname)" = "Darwin" ]; then \ |
| 30 |
echo "sed -i '' 's/ciinfo/main/' compile-constants/vendors.go"; \ |
| 31 |
else \ |
| 32 |
echo "sed -i 's/ciinfo/main/' compile-constants/vendors.go"; \ |
| 33 |
fi) | sh |
| 34 |
go run ./compile-constants/main.go ./compile-constants/vendors.go |