| 1 | GO ?= $(shell go env GOROOT)/bin/go |
| 2 | |
| 3 | GENERATOR_DIRS=ping runner |
| 4 | |
| 5 | BUF_PACKAGE=github.com/bufbuild/buf/cmd/[email protected] # renovate: datasource=go |
| 6 | GRPCURL_PACKAGE=github.com/fullstorydev/grpcurl/cmd/[email protected] # renovate: datasource=go |
| 7 | PROTOC_GEN_GO_PACKAGE=google.golang.org/protobuf/cmd/[email protected] # renovate: datasource=go |
| 8 | PROTOC_GEN_GO_GRPC_PACKAGE=google.golang.org/grpc/cmd/[email protected] # renovate: datasource=go |
| 9 | PROTOC_GEN_CONNECT_GO_PACKAGE=connectrpc.com/connect/cmd/[email protected] # renovate: datasource=go |
| 10 | |
| 11 | .PHONY: install |
| 12 | install: |
| 13 | $(GO) install $(BUF_PACKAGE) |
| 14 | $(GO) install $(GRPCURL_PACKAGE) |
| 15 | $(GO) install $(PROTOC_GEN_GO_PACKAGE) |
| 16 | $(GO) install $(PROTOC_GEN_GO_GRPC_PACKAGE) |
| 17 | $(GO) install $(PROTOC_GEN_CONNECT_GO_PACKAGE) |
| 18 | |
| 19 | .PHONY: lint |
| 20 | lint: |
| 21 | buf lint |
| 22 | buf format --diff --exit-code |
| 23 | |
| 24 | .PHONY: format |
| 25 | format: |
| 26 | buf format --diff -w |
| 27 | |
| 28 | .PHONY: generator-check |
| 29 | generator-check: |
| 30 | @rm -fr $(GENERATOR_DIRS) |
| 31 | @buf generate |
| 32 | @git diff --exit-code --color=always --cached $(GENERATOR_DIRS) \ |
| 33 | || (code=$$?; echo "Please run 'make generator' and commit the result"; exit $${code}) |
| 34 | |
| 35 | .PHONY: generator |
| 36 | generator: |
| 37 | buf generate |