Skip to content

Instantly share code, notes, and snippets.

@timburks
Created October 8, 2021 03:24
Show Gist options
  • Save timburks/0c0c0d5e0e3fb2a370c81cbec4073104 to your computer and use it in GitHub Desktop.
Save timburks/0c0c0d5e0e3fb2a370c81cbec4073104 to your computer and use it in GitHub Desktop.
protoc compilation challenge
#!/bin/sh
# clone envoy and dependencies
if [ ! -d "envoy" ]
then
git clone git@github.com:envoyproxy/envoy
fi
if [ ! -d "protoc-gen-validate" ]
then
git clone git@github.com:envoyproxy/protoc-gen-validate
fi
if [ ! -d "udpa" ]
then
git clone git@github.com:cncf/udpa
fi
if [ ! -d "xds" ]
then
git clone git@github.com:cncf/xds
fi
# verify that protoc is in your path
echo "protoc version `protoc --version`"
# I have libprotoc 3.14.0
# verify that protoc-gen-go is in your path
echo "protoc-gen-go version `protoc-gen-go --version`"
# I have protoc-gen-go v1.27.1
protoc envoy/api/envoy/service/ext_proc/v3/external_processor.proto \
-I envoy/api \
-I protoc-gen-validate \
-I udpa \
-I xds \
--go_out=. \
--go_opt=Menvoy/annotations/deprecation.proto=github.com/generated \
--go_opt=Menvoy/config/core/v3/address.proto=github.com/generated \
--go_opt=Menvoy/config/core/v3/backoff.proto=github.com/generated \
--go_opt=Menvoy/config/core/v3/base.proto=github.com/generated \
--go_opt=Menvoy/config/core/v3/http_uri.proto=github.com/generated \
--go_opt=Menvoy/config/core/v3/socket_option.proto=github.com/generated \
--go_opt=Menvoy/extensions/filters/http/ext_proc/v3/processing_mode.proto=github.com/generated \
--go_opt=Menvoy/service/ext_proc/v3/external_processor.proto=github.com/generated \
--go_opt=Menvoy/type/v3/http_status.proto=github.com/generated \
--go_opt=Menvoy/type/v3/percent.proto=github.com/generated \
--go_opt=Menvoy/type/v3/semantic_version.proto=github.com/generated \
--go_opt=Mudpa/annotations/migrate.proto=github.com/generated \
--go_opt=Mudpa/annotations/status.proto=github.com/generated \
--go_opt=Mudpa/annotations/versioning.proto=github.com/generated \
--go_opt=Mxds/core/v3/context_params.proto=github.com/generated
# The --go_opt lines are needed by the go protoc plugin.
# It expects a "go_package" argument in proto files; if none is present,
# the go package for the file must be specified with the command-line
# options used above.
# https://developers.google.com/protocol-buffers/docs/reference/go-generated#package
echo "generated: `find github.com -name *.go`"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment