Created
April 21, 2021 09:16
-
-
Save 42atomys/454a1b1b4d6d849ce9e1af83fd4b67f4 to your computer and use it in GitHub Desktop.
Makefile for install protoc-gen dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: proto-deps proto-build | |
proto-deps: | |
@ if ! which protoc > /dev/null; then \ | |
echo "error: protoc not installed" >&2; \ | |
exit 1; \ | |
fi | |
go mod tidy | |
go install \ | |
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \ | |
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \ | |
google.golang.org/protobuf/cmd/protoc-gen-go \ | |
google.golang.org/grpc/cmd/protoc-gen-go-grpc | |
proto-build: | |
protoc -I ./proto \ | |
--go_out ./api/generated --go_opt paths=source_relative \ | |
--go-grpc_out ./api/generated \ | |
--go-grpc_opt paths=source_relative \ | |
--grpc-gateway_out ./api/generated \ | |
--grpc-gateway_opt logtostderr=true \ | |
--grpc-gateway_opt paths=source_relative \ | |
./proto/api.proto | |
.PHONY: \ | |
all \ | |
proto-deps \ | |
proto-build \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment