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

goctl rpc proto 生成代码文件的时候报异常 #825

Closed
fuckqqcom opened this issue Jul 18, 2021 · 10 comments
Closed

goctl rpc proto 生成代码文件的时候报异常 #825

fuckqqcom opened this issue Jul 18, 2021 · 10 comments

Comments

@fuckqqcom
Copy link

goctl rpc proto -src .\b.proto -dir . -style go_zero

目录:

        b.proto
        common.proto
    
  common.proto:
          syntax = "proto3";
          package common;
          option go_package ="./src";
           message RetResp {
                   bytes Data = 1;
            }
           message Empty {}
   b.proto:
         syntax = "proto3";
         import "common.proto";
        import "google/protobuf/empty.proto";
         package b;

         option go_package ="./src";

         service B{
              rpc Hello(common.Empty) returns(common.RetResp);
              rpc Api(google.protobuf.Empty) returns(RetResp);
         }

在上面引入google中的Empty 和自己common.proto中定义的message ,goctl rpc proto 生成代码都报错:request type must defined in b.proto

protoc version: libprotoc 3.17.3
goctl :goctl.exe version 1.1.6 windows/amd64

@kesonan
Copy link
Collaborator

kesonan commented Jul 18, 2021

@xhochipe 这个我在文档中有说明,request和response不支持外部的message。

@arthur-jx
Copy link

@xhochipe 这个我在文档中有说明,request和response不支持外部的message。

在一个项目中,很多结构本来是可以共用的,不支持外部的message, 就需要在各个.proto中重复定义,这会给维护带来了很多不方便和不一致呀?

@Issues-translate-bot
Copy link

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


@xhochipe I have stated in the documentation that request and response do not support external messages.

In a project, many structures can be shared. If external messages are not supported, they need to be repeatedly defined in each .proto. This will bring a lot of inconvenience and inconsistency to maintenance.

@gghtrt520
Copy link

期望加强,不然proto文件中定义的message就重复太多了

@Issues-translate-bot
Copy link

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


It is expected to be strengthened, otherwise the message defined in the proto file will be repeated too much

@Danny5487401
Copy link

哪时候可以支持外部的message @anqiansong

@wuyazi
Copy link

wuyazi commented Jun 14, 2023

最近也遇到了,希望能支持下。
看了下代码,支持的话,除了影响 logic 和 client 的生成,还影响别的不
@anqiansong

@Issues-translate-bot
Copy link

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


I also encountered it recently, and hope to support it.
After reading the code, if it is supported, in addition to affecting the generation of logic and client, it will also affect other
@anqiansong

@Visforest
Copy link

如果不支持引入外部 protobuf 的话,protobuf 本身的功能就会大打折扣,造成很多代码冗余,go-zero 就显得很鸡肋了

@Issues-translate-bot
Copy link

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


If the introduction of external protobuf is not supported, the function of protobuf itself will be greatly reduced, resulting in a lot of code redundancy, and go-zero will appear to be useless.

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

8 participants