-
Notifications
You must be signed in to change notification settings - Fork 558
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
optimize(hz): use relative path for grpc generated file #1022
base: develop
Are you sure you want to change the base?
Conversation
Please sign the CLA |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1022 +/- ##
===========================================
+ Coverage 82.55% 82.60% +0.05%
===========================================
Files 98 98
Lines 9974 9974
===========================================
+ Hits 8234 8239 +5
+ Misses 1244 1240 -4
+ Partials 496 495 -1 ☔ View full report in Codecov by Sentry. |
f62a50f
to
26dde13
Compare
Please fill the PR description according to the template. Here is a example: #1016 |
@@ -364,6 +364,10 @@ func (plugin *Plugin) GenerateFile(gen *protogen.Plugin, f *protogen.File) error | |||
if strings.HasPrefix(impt, plugin.Package) { | |||
impt = impt[len(plugin.Package):] | |||
} | |||
// The file name must be the relative path, reference https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/compiler/plugin.proto#L122 | |||
if strings.HasPrefix(impt, "/") { | |||
impt = impt[1:] |
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.
Removing the prefix “/” directly is not always right way to transfer absolute path to relative path?
An implicit premise is that the current work dir needs to be in "/"?
If there is something I missed please let me know🙏
What type of PR is this?
optimize
Check the PR title.
(Optional) Translate the PR title into Chinese.
go_package 使用相对路径去适配 grpc 的生成代码
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en: go_package use relative path to adapt 'grpc-generated code'
zh(optional): go_package 使用相对路径去适配 grpc 的生成代码
(Optional) Which issue(s) this PR fixes:
(Optional) The PR that updates user documentation: