cloudwego / cloudwego/hertz

生成 model 文件路径不符合预期

Open
#1,154 6 comments 0 reactions 0 assignees View on GitHub
tool
Dominant language
Go
Stars
7.4k
Forks
643
Avg merge
14h 5m
Merged PRs (30d)
2

Description

**Describe the bug**

我在 proto 文件中定义了 go_packages,然后我使用 hz update 去生成相应的model文件,结果生成的文件路径与我在 proto 定义的文件路径不符

**Replay**
我的项目名为 hello
1. 创建 idl/hello/hello.proto 文件
2. 将 demo 中的文件内容复制进去
3. 编辑 go_packages 路径(只要路径中包含 “hello”子字串即可,此处假设为 hertz/hello1 )
4. 运行 `hz new -module hello -I idl -idl idl/hello/hello.proto`
5. hello.pb.go 预期应该生成在 biz/model 下的 hertz/hello1 文件夹。但是实际上却是在 biz/model 的根目录下
6. 编辑 go_packages 路径更新为 hertz/hell
7. 运行 `hz update -I idl -idl idl/hello/hello.proto`
8. 实际运行结果如预期:hello.pb.go 生成在 biz/model 下的 hertz/hell 文件夹

**Note**
只要我的go_packages 路径中包含或者等于 hello,这个实际生成的 pb 文件路径就会有问题

**Hertz version:**

```
hz -version
hz version v0.9.0
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with `hz new` and `hz update` using `idl/hello/hello.proto`, the `go_packages` values `hertz/hello1` and `hertz/hell`, and Hertz v0.9.0. Trace how these commands resolve the output path for `hello.pb.go` under `biz/model`; done means paths containing `hello` are generated consistently with the proto definition.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system, cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.