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 empty parameter fatal in protoc-gen-grpc-gateway #1752

Merged

Conversation

danielhochman
Copy link
Contributor

@danielhochman danielhochman commented Oct 14, 2020

Fixes #1751

Have you read the Contributing Guidelines?

Yes

Brief description of what is fixed or changed

Split() on an empty parameter set for protoc-gen-grpc-gateway would cause a fatal since the for loop woulds still execute with an empty string.

Fixed with an early return and added some small tests.

F1014 11:23:06.564537  195394 main.go:115] Cannot set flag 
goroutine 1 [running]:
github.com/golang/glog.stacks(0xc000628000, 0xc0001ae680, 0x3c, 0x40)
        /home/danielhochman/go/pkg/mod/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/glog.go:769 +0xb8
github.com/golang/glog.(*loggingT).output(0xb8c4c0, 0xc000000003, 0xc0001fbf80, 0xb5bcf1, 0x7, 0x73, 0x0)
        /home/danielhochman/go/pkg/mod/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/glog.go:720 +0x372
github.com/golang/glog.(*loggingT).printf(0xb8c4c0, 0x3, 0x843bf2, 0x12, 0xc000295bc8, 0x1, 0x1)
        /home/danielhochman/go/pkg/mod/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/glog.go:655 +0x14b
github.com/golang/glog.Fatalf(...)
        /home/danielhochman/go/pkg/mod/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/glog.go:1148
main.parseFlags(0xc0001b4750, 0x0, 0x0)
        /home/danielhochman/go/src/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/main.go:115 +0x444
main.main.func1(0xc00039d5e0, 0x0, 0xc0001fa000)
        /home/danielhochman/go/src/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/main.go:68 +0x79
google.golang.org/protobuf/compiler/protogen.run(0xc0001977a0, 0x0, 0xc000295f30, 0xb8ce20, 0x7f326cb7ee98)
        /home/danielhochman/go/pkg/mod/google.golang.org/protobuf@v1.25.0/compiler/protogen/protogen.go:76 +0x142
google.golang.org/protobuf/compiler/protogen.Options.Run(0xc0001977a0, 0x0, 0xc000251f30)
        /home/danielhochman/go/pkg/mod/google.golang.org/protobuf@v1.25.0/compiler/protogen/protogen.go:54 +0x5a
main.main()
        /home/danielhochman/go/src/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/main.go:66 +0x2d1
--grpc-gateway_out: protoc-gen-grpc-gateway: Plugin failed with status code 255.

Other comments

@google-cla
Copy link

google-cla bot commented Oct 14, 2020

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Oct 14, 2020
@johanbrandhorst
Copy link
Collaborator

Thanks for this! Could you please run the bazel generator from the contribution guidelines to fix the test failure?

@google-cla
Copy link

google-cla bot commented Oct 14, 2020

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@danielhochman
Copy link
Contributor Author

@johanbrandhorst done, sorry about that. Also I should have CLA signed within next 24 hours hopefully. Waiting on some internal review for our corp CLA.

@danielhochman
Copy link
Contributor Author

@googlebot I signed it!

@google-cla
Copy link

google-cla bot commented Oct 14, 2020

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: yes and removed cla: no labels Oct 14, 2020
@johanbrandhorst
Copy link
Collaborator

I think this will change soon with the work @adambabik is doing, but thanks for this quick hold-over fix.

@johanbrandhorst johanbrandhorst merged commit b152277 into grpc-ecosystem:master Oct 15, 2020
danielhochman added a commit to lyft/clutch that referenced this pull request Oct 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

grpc-gateway_out Cannot set flag
2 participants