#!/usr/bin/env bash # Generate Go gRPC stubs from the vendored protos into go/genpb/. # The protos carry no `option go_package`, so each is mapped explicitly here. # internal_proxy.proto is server-internal and intentionally skipped. set -euo pipefail here="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$here/go" export PATH="$(go env GOPATH)/bin:$PATH" MOD=git.awesomike.com/pub/waymaker-client/go # proto filename (relative to ../proto) -> Go package dir under the module protos=( waymaker_locks.proto:genpb/locks waymaker_streams.proto:genpb/streams kv.proto:genpb/kv collections.proto:genpb/collections sketches.proto:genpb/sketches cache.proto:genpb/cache ) files=() mflags=() for entry in "${protos[@]}"; do f="${entry%%:*}"; pkg="${entry##*:}" files+=("$f") mflags+=("--go_opt=M$f=$MOD/$pkg" "--go-grpc_opt=M$f=$MOD/$pkg") done rm -rf genpb protoc -I ../proto \ --go_out=. --go_opt=module="$MOD" \ --go-grpc_out=. --go-grpc_opt=module="$MOD" \ "${mflags[@]}" \ "${files[@]}" echo "Generated Go stubs under go/genpb/"