File size: 861 Bytes
b110593
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env bash
set -euo pipefail

GEN_DIR=./grpc/generated
OUT_DIR="$GEN_DIR/protocol"

echo "Generating Go protocol stubs..."

rm -fr $OUT_DIR && mkdir -p $OUT_DIR && cd $GEN_DIR && protoc \
    --proto_path=../proto \
    --go_out=paths=source_relative:protocol \
    --go-grpc_out=paths=source_relative:protocol \
    ../proto/v0/*.proto && protoc \
    --proto_path=../proto \
    --go_out=paths=source_relative:protocol \
    --go-grpc_out=paths=source_relative:protocol \
    ../proto/v1/*.proto

cd - && sed -i '' '/versions:/, /source: .*/d' ./grpc/generated/protocol/**/*.go

go run ./tools/license_headers/main.go

goimports -w $OUT_DIR

# running gofumpt twice is on purpose
# it doesn't work for the first time only after second run the formatting is proper
gofumpt -w $OUT_DIR
gofumpt -w $OUT_DIR

echo "Success"