Created
October 12, 2021 02:40
-
-
Save jxlwqq/db2e8fe10d3e87f172cef9866bda701f to your computer and use it in GitHub Desktop.
make proto
This file contains hidden or 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
.PHONY: proto | |
proto: | |
@ if ! which protoc > /dev/null; then \ | |
echo "error: protoc not installed" >&2; \ | |
exit 1; \ | |
fi | |
@ if ! which protoc-gen-go > /dev/null; then \ | |
echo "error: protoc-gen-go not installed" >&2; \ | |
exit 1; \ | |
fi | |
@ if ! which protoc-gen-go-grpc > /dev/null; then \ | |
echo "error: protoc-gen-go-grpc not installed" >&2; \ | |
exit 1; \ | |
fi | |
@ if ! which protoc-gen-micro > /dev/null; then \ | |
echo "error: protoc-gen-micro not installed" >&2; \ | |
exit 1; \ | |
fi | |
for file in $$(git ls-files '*.proto'); do \ | |
protoc -I $$(dirname $$file) \ | |
--go_out=:$$(dirname $$file) --go_opt=paths=source_relative \ | |
--go-grpc_out=:$$(dirname $$file) --go-grpc_opt=paths=source_relative \ | |
--micro_out=:$$(dirname $$file) --micro_opt=paths=source_relative \ | |
$$file; \ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If Not Installed:
Reference: