mirror of
https://github.com/outbackdingo/matchbox.git
synced 2026-03-21 12:43:25 +00:00
scripts: Move development-only scripts under scripts/dev
This commit is contained in:
22
scripts/dev/codegen
Executable file
22
scripts/dev/codegen
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# USAGE ./scripts/codegen
|
||||
# Generate Go protocol buffer code from proto definitions
|
||||
|
||||
set -eu
|
||||
|
||||
# Add protoc and protoc-gen-go tools to PATH
|
||||
export PATH=$PWD/bin:$PATH
|
||||
|
||||
# protobuf subpackages end in "pb"
|
||||
PBUFS=$(go list ./... | grep -v /vendor | grep 'pb$')
|
||||
|
||||
# change into each protobuf directory
|
||||
for pkg in $PBUFS ; do
|
||||
abs_path=${GOPATH}/src/${pkg}
|
||||
echo Generating $abs_path
|
||||
pushd ${abs_path} > /dev/null
|
||||
# generate protocol buffers, make other .proto files available to import
|
||||
protoc --go_out=plugins=grpc:. -I=.:"${GOPATH}/src/" *.proto
|
||||
popd > /dev/null
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user