1
0
mirror of https://github.com/prometheus/alertmanager.git synced 2026-02-05 15:45:34 +01:00
Files

34 lines
790 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
#
# Generate all protobuf bindings.
# Run from repository root.
set -e
set -u
if ! [[ "$0" =~ "scripts/genproto.sh" ]]; then
echo "must be run from repository root"
exit 255
fi
pushd "internal/tools"
INSTALL_PKGS="github.com/bufbuild/buf/cmd/buf golang.org/x/tools/cmd/goimports github.com/gogo/protobuf/protoc-gen-gogofast"
for pkg in ${INSTALL_PKGS}; do
go install "$pkg"
done
popd
2018-02-07 16:36:47 +01:00
DIRS="nflog/nflogpb silence/silencepb cluster/clusterpb"
echo "generating files"
for dir in ${DIRS}; do
pushd ${dir}
buf dep update
buf generate
sed -i.bak -E 's/import _ \"gogoproto\"//g' *.pb.go
sed -i.bak -E 's/import _ \"google\/protobuf\"//g' *.pb.go
sed -i.bak -E 's/\t_ \"google\/protobuf\"//g' -- *.pb.go
rm -f *.bak
goimports -w *.pb.go
popd
done