Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
samtake opened this issue Oct 24, 2024 · 3 comments

Comments

@samtake
Copy link

samtake commented Oct 24, 2024

What would you like to share?

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

Additional information

No response

@OpenIM-Robot OpenIM-Robot changed the title 项目proto相关文件的重新生成:这里的gen.sh脚本是怎么用的? Regeneration of project proto related files: How is the gen.sh script used here? Oct 24, 2024
@samtake
Copy link
Author

samtake commented Oct 25, 2024

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

#!/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
Copy link
Member

Thank you

@OpenIM-Robot
Copy link

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


Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants