cloudwego / cloudwego/kitex

Kitex does not guarantee that generated dependency package aliases will be unique

Open
#1,892 2 comments 0 reactions 1 assignee Claimed by @HeyJavaBean View on GitHub
bug tool
Dominant language
Go
Stars
8k
Forks
918
Avg merge
1d 13h
Merged PRs (30d)
7

Description

**Describe the bug**
There is a Project Structure:
reporoot/
idl
│   └── protobuffer
│   ├── base
│   │   ├── packagea
│   │   │   └── v1
│   │   │   └── examplea.proto
│   │   └── packageb
│   │   └── v1
│   │   └── exampleb.proto
│   └── example
│   └── v1
│   └── combine.proto

the file `conbine.proto` imports `examplea.proto` and `exampleb.proto` both.

after I do a generate action, `kitex -type protobuf -I . idl/protobuffer/example/v1/combine.proto`,

there are import package conflicts in generated stubs, like this:
```
client.go
import (
"context"
client "github.com/cloudwego/kitex/client"
callopt "github.com/cloudwego/kitex/client/callopt"
v1 "kitexidltest/kitex_gen/base/packagea/v1"
v1 "kitexidltest/kitex_gen/example/v1"
)
```

```
combine.pb.go

import (
"context"
"kitexidltest/kitex_gen/base/packagea/v1"
"kitexidltest/kitex_gen/base/packageb/v1"

"github.com/cloudwego/prutal"
)

```

**To Reproduce**
[ReproduceRepo](https://github.com/shanezhiu/kitextest)

**Expected behavior**

the genertor guarantee that generated dependency package aliases will be unique

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.