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

特定情况下代码生成错误。没有正确的使用 go package #27

Open
HeyJavaBean opened this issue Dec 5, 2024 · 0 comments
Open
Labels
C-bug This is a bug-report. Bug-fix PRs use `C-enhancement` instead.

Comments

@HeyJavaBean
Copy link
Member

HeyJavaBean commented Dec 5, 2024

Describe the bug

cloudwego/kitex#1624

To Reproduce

  • model.proto :
syntax = "proto3";

package svc;
option go_package = "svc/model";

message Model {
    // 这里定义一个嵌套的 message
    message SubModel {
        int64 id = 1;
    }

    int64 id = 1;
    string name = 2;
}
  • req.proto
syntax = "proto3";

package svc; // 这里 proto 的 package 与 model.proto 相同
option go_package = "svc/req"; // 这里 go 的package 与 model.proto 不同

import "model.proto"; // 这里引入 model

message Req {
    Model md = 1; // 这个引用,在 go 代码中能正确加上 model package
    Model.SubModel = 2; // 这个引用,没有加 model package 导致编译错误
}

使用 kitex 生成 fastapi

kitex -I ${PBPATH} ./req.proto

生成的 fastapi 代码中,Model 类型的引用缺少 go package

Screenshots
image

@HeyJavaBean HeyJavaBean added the C-bug This is a bug-report. Bug-fix PRs use `C-enhancement` instead. label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug This is a bug-report. Bug-fix PRs use `C-enhancement` instead.
Development

No branches or pull requests

1 participant