Skip to content

Instantly share code, notes, and snippets.

@42atomys
Created April 21, 2021 09:16
Show Gist options
  • Save 42atomys/454a1b1b4d6d849ce9e1af83fd4b67f4 to your computer and use it in GitHub Desktop.
Save 42atomys/454a1b1b4d6d849ce9e1af83fd4b67f4 to your computer and use it in GitHub Desktop.
Makefile for install protoc-gen dependencies
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