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

fix(protoc-gen-go-http): return nil if err == nil。 #3188

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

kvii
Copy link
Contributor

@kvii kvii commented Feb 3, 2024

Description (what this PR does / why we need it):

Consider these codes that generated by "protoc-gen-go-http":

// "api/helloworld/v1/greeter_http.pb.go"
func (c *GreeterHTTPClientImpl) SayHello(ctx context.Context, in *HelloRequest, opts ...http.CallOption) (*HelloReply, error) {
	var out HelloReply
	pattern := "/helloworld/{name}"
	path := binding.EncodeURL(pattern, in, true)
	opts = append(opts, http.Operation(OperationGreeterSayHello))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, err // <--
}

It's better to return &out, nil instead of &out, err.

Which issue(s) this PR fixes (resolves / be part of):

Other special notes for the reviewers:

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Feb 3, 2024
@codecov-commenter
Copy link

codecov-commenter commented Feb 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c7fa51d) 84.62% compared to head (770425b) 84.72%.

❗ Current head 770425b differs from pull request most recent head dea9814. Consider uploading reports for the commit dea9814 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3188      +/-   ##
==========================================
+ Coverage   84.62%   84.72%   +0.10%     
==========================================
  Files          88       88              
  Lines        3993     3993              
==========================================
+ Hits         3379     3383       +4     
+ Misses        440      438       -2     
+ Partials      174      172       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dosubot dosubot bot added the LGTM label Feb 4, 2024
@hawkingrei hawkingrei merged commit 9106991 into go-kratos:main Feb 14, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants