-
Notifications
You must be signed in to change notification settings - Fork 48
/
gen.sh
executable file
·41 lines (37 loc) · 937 Bytes
/
gen.sh
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
34
35
36
37
38
39
40
41
PROTO_NAMES=(
"auth"
"conversation"
"errinfo"
"relation"
"group"
"jssdk"
"msg"
"msggateway"
"push"
"rtc"
"sdkws"
"third"
"user"
"statistics"
"wrapperspb"
)
for name in "${PROTO_NAMES[@]}"; do
protoc --go_out=./${name} --go_opt=module=github.com/openimsdk/protocol/${name} ${name}/${name}.proto
if [ $? -ne 0 ]; then
echo "error processing ${name}.proto (go_out)"
exit $?
fi
done
# generate go-grpc
for name in "${PROTO_NAMES[@]}"; do
protoc --go-grpc_out=./${name} --go-grpc_opt=module=github.com/openimsdk/protocol/${name} ${name}/${name}.proto
if [ $? -ne 0 ]; then
echo "error processing ${name}.proto (go-grpc_out)"
exit $?
fi
done
if [ "$(uname -s)" == "Darwin" ]; then
find . -type f -name '*.pb.go' -exec sed -i '' 's/,omitempty"`/\"\`/g' {} +
else
find . -type f -name '*.pb.go' -exec sed -i 's/,omitempty"`/\"\`/g' {} +
fi