-
Notifications
You must be signed in to change notification settings - Fork 539
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
fix(cmd/hz): unexpected generated model file path #1155
Open
3DRX
wants to merge
7
commits into
cloudwego:develop
Choose a base branch
from
3DRX:fix/unexpected_generated_package_path
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
fix(cmd/hz): unexpected generated model file path #1155
3DRX
wants to merge
7
commits into
cloudwego:develop
from
3DRX:fix/unexpected_generated_package_path
Conversation
This file contains 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
using strings.Contains
关于测试: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)
}
} 是否应该更新这个测试用例,还是追加一个测试用例。 |
你添加一个测试用例吧 |
我提交了一个 commit 把一部分逻辑提到一个函数里使其更好测试,并添加了一组测试用例。 |
Skyenought
approved these changes
Jul 19, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
PazVz
approved these changes
Jul 25, 2024
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.Contains
to 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