fix(cmd/hz): unexpected generated model file path#1155
Open
3DRX wants to merge 7 commits intocloudwego:developfrom
Open
fix(cmd/hz): unexpected generated model file path#11553DRX wants to merge 7 commits intocloudwego:developfrom
3DRX wants to merge 7 commits intocloudwego:developfrom
Conversation
using strings.Contains
Contributor
Author
|
关于测试:plugin_test.go 中 for _, r := range ret1 {
tmp := r[0]
if !strings.Contains(tmp, plu.Package) {
if strings.HasPrefix(tmp, "/") {
tmp = plu.Package + tmp
} else {
tmp = plu.Package + "/" + tmp
}
}
result, _ := plu.fixModelPathAndPackage(tmp)
if result != r[1] {
t.Fatalf("want go package: %s, but get: %s", r[1], result)
}
}是否应该更新这个测试用例,还是追加一个测试用例。 |
Contributor
|
你添加一个测试用例吧 |
Contributor
Author
我提交了一个 commit 把一部分逻辑提到一个函数里使其更好测试,并添加了一组测试用例。 |
PazVz
approved these changes
Jul 25, 2024
Contributor
jayantxie
approved these changes
May 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
using strings.Contains
What type of PR is this?
Check the PR title.
Translate the PR title into Chinese.
解决:生成 model 文件路径不符合预期
More detailed description for this PR(en: English/zh: Chinese).
en: Originally in Plugin.fixGoPackage, we used
strings.Containsto decide if the go_package string already contains the top-level package name. Still, as #1154 shows, this can cause trouble when go_package happens to contain a substring that's identical to top level package name.zh: 原有的 Plugin.fixGoPackage 中使用
strings.Contains来判断 go_package 中是否包含项目包名,但是如 #1154 ,这样会导致路径其他地方包含同样字串时路径错误。Which issue(s) this PR fixes:
Fixes #1154