blob: e82320ebd4cede8c02264ee2f1a068122983b495 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/env bash
# stolen from prometheus
#
# Generate all protobuf bindings.
# Run from repository root.
set -x
set -e
set -u
if ! [[ "$0" =~ "tools/grpc/genproto.sh" ]]; then
echo "must be run from repository root"
exit 255
fi
if ! [[ $(protoc --version) =~ "3.7.1" ]]; then
echo "could not find protoc 3.7.1, is it installed + in PATH?"
exit 255
fi
echo "installing plugins"
GO111MODULE=on go mod download
INSTALL_PKGS="github.com/golang/protobuf/protoc-gen-go"
for pkg in ${INSTALL_PKGS}; do
GO111MODULE=on go install "$pkg"
done
GOBGP="${PWD}"
echo "generating code"
protoc -I "${GOBGP}"/api \
--go_out=plugins=grpc:${GOBGP}/api "${GOBGP}"/api/*.proto
|