|
| 1 | +VERSION=$(shell git describe --tags --always) |
| 2 | + |
| 3 | +.PHONY: init |
| 4 | +# init env |
| 5 | +init: |
| 6 | + go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30.0 |
| 7 | + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0 |
| 8 | + go install github.com/envoyproxy/protoc-gen-validate@v1.0.1 |
| 9 | + go install github.com/go-kratos/kratos/cmd/protoc-gen-go-errors/v2@latest |
| 10 | + go install github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2@latest |
| 11 | + go install github.com/google/wire/cmd/wire@latest |
| 12 | + go install github.com/vektra/mockery/v2@v2.20.0 |
| 13 | + go install ariga.io/atlas/cmd/atlas@v0.12.0 |
| 14 | + go install github.com/bufbuild/buf/cmd/buf@v1.10.0 |
| 15 | + |
| 16 | +# show help |
| 17 | +help: |
| 18 | + @echo '' |
| 19 | + @echo 'Usage:' |
| 20 | + @echo ' make [target]' |
| 21 | + @echo '' |
| 22 | + @echo 'Targets:' |
| 23 | + @awk '/^[a-zA-Z\-_0-9]+:/ { \ |
| 24 | + helpMessage = match(lastLine, /^# (.*)/); \ |
| 25 | + if (helpMessage) { \ |
| 26 | + helpCommand = substr($$1, 0, index($$1, ":")-1); \ |
| 27 | + helpMessage = substr(lastLine, RSTART + 2, RLENGTH); \ |
| 28 | + printf "\033[36m%-22s\033[0m %s\n", helpCommand,helpMessage; \ |
| 29 | + } \ |
| 30 | + } \ |
| 31 | + { lastLine = $$0 }' $(MAKEFILE_LIST) |
| 32 | + |
| 33 | +.DEFAULT_GOAL := help |
| 34 | + |
| 35 | +.PHONY: check-goreleaser-tool |
| 36 | +check-atlas-tool: |
| 37 | + @if ! command -v atlas >/dev/null 2>&1; then \ |
| 38 | + echo "altas is not installed. Please run \"make init\" or install the tool manually."; \ |
| 39 | + exit 1; \ |
| 40 | + fi |
| 41 | + |
| 42 | +.PHONY: check-wire-tool |
| 43 | +check-wire-tool: |
| 44 | + @if ! command -v wire >/dev/null 2>&1; then \ |
| 45 | + echo "wire is not installed. Please run \"make init\" or install the tool manually."; \ |
| 46 | + exit 1; \ |
| 47 | + fi |
| 48 | + |
| 49 | +.PHONY: check-golangci-lint-tool |
| 50 | +check-golangci-lint-tool: |
| 51 | + @if ! command -v golangci-lint >/dev/null 2>&1; then \ |
| 52 | + echo "golangci-lint is not installed. Please run \"make init\" or install the tool manually."; \ |
| 53 | + exit 1; \ |
| 54 | + fi |
| 55 | + |
| 56 | +.PHONY: check-buf-tool |
| 57 | +check-buf-tool: |
| 58 | + @if ! command -v buf >/dev/null 2>&1; then \ |
| 59 | + echo "buf is not installed. Please run \"make init\" or install the tool manually."; \ |
| 60 | + exit 1; \ |
| 61 | + fi |
| 62 | + |
0 commit comments