openimsdk / chat

A business server that includes user registration and login, deployed together with Open-IM-Server, can be used to set up a chat product.
https://openim.io
GNU General Public License v3.0
90 stars 111 forks source link

Regeneration of project proto related files: How is the gen.sh script used here? #605

Closed samtake closed 5 days ago

samtake commented 2 weeks ago

What would you like to share?

如下图:我修改了chat.proto文件,想要重新生成对应的相关文件,执行gen脚本报错了,请问正确的操作方式是? 999999

Additional information

No response

samtake commented 2 weeks ago

已解決,把腳本改成這樣子:

#!/bin/bash

PROTO_NAMES=(
    "admin"
    "chat"
    "common"
)

for name in "${PROTO_NAMES[@]}"; do
    # 生成普通的 Go 代码
    protoc --go_out=./${name} --go_opt=module=github.com/openimsdk/chat/pkg/protocol/${name} ${name}/${name}.proto
    # 生成 gRPC 代码
    protoc --go-grpc_out=./${name} --go-grpc_opt=module=github.com/openimsdk/chat/pkg/protocol/${name} ${name}/${name}.proto
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
skiffer-git commented 5 days ago

Thank you

OpenIM-Robot commented 5 days ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Thank you