Skip to content
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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

loveyana
Copy link

@loveyana loveyana commented Dec 11, 2023

What type of PR is this?

optimize

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(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:

@loveyana loveyana requested review from a team as code owners December 11, 2023 14:51
@CLAassistant
Copy link

CLAassistant commented Dec 11, 2023

CLA assistant check
All committers have signed the CLA.

@FGYFFFF
Copy link
Contributor

FGYFFFF commented Dec 12, 2023

Please sign the CLA

Copy link

codecov bot commented Dec 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (82f9bfa) 82.55% compared to head (26dde13) 82.60%.
Report is 5 commits behind head on develop.

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.
📢 Have feedback on the report? Share it here.

@welkeyever welkeyever changed the title fix: use relative path for grpc generated file fix(hz): use relative path for grpc generated file Dec 27, 2023
@welkeyever
Copy link
Member

Please fill the PR description according to the template. Here is a example: #1016

@FGYFFFF FGYFFFF changed the title fix(hz): use relative path for grpc generated file optimize(hz): use relative path for grpc generated file Jan 10, 2024
@@ -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:]
Copy link
Member

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🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants