-
Notifications
You must be signed in to change notification settings - Fork 469
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 gRPC and bidirectional examples' code generation instructions #250
Conversation
This was done using the latest release of protoc as of this authoring, 3.15.8. Whatever very old version of protoc was used before was not stated, so in order to ensure that the example instructions still worked, we wanted to use the latest available now. Updating the grpc and protobuf dependencies was required, as well as adding the `go_package` option to the .proto file. This fixes hashicorp#249. Co-authored-by: crashdummy101 <129228667+crashdummy101@users.noreply.github.com> Co-authored-by: czavieh <czavieh@users.noreply.github.com>
We manually re-inserted the copyright notices, since the generated code did not include them for some reason (even though it did for the golang code.) Co-authored-by: crashdummy101 <129228667+crashdummy101@users.noreply.github.com> Co-authored-by: czavieh <czavieh@users.noreply.github.com>
We weren't sure why there is a net/rpc example in the grpc folder, but it seemed like a waste for it to stay broken the way it was, so, this code allows it to be used in the way documented by the README. Co-authored-by: crashdummy101 <129228667+crashdummy101@users.noreply.github.com>
Please accept my apologies about the delay in signing the CLA. I did not realize I had not already signed the CLA a long time ago, and I'm checking with my employer's legal department to make sure it's ok for me to sign it. |
I got approval to sign from my employer. I am surprised that the bot does not require the commit co-authors to also sign, but I'll ask them to do it too. Edit: we have all signed the CLA, so we should be good to go. |
Co-authored-by: crashdummy101 <129228667+crashdummy101@users.noreply.github.com>
It's very similar to the gRPC example, and uses the same generation process, so it needed to be updated in the same way. This wasn't on our radar because we weren't referencing it, but after noticing that the "negotiated" example was using the grpc example's code, we decided to ensure all four examples were working as documented. Of course, we also updated the README, and made sure to include a .gitignore since this example was missing one. Co-authored-by: crashdummy101 <129228667+crashdummy101@users.noreply.github.com>
Unknown flag: --go-grpc_opt |
@heaxo you might have an out of date version of |
Hey @2rs2ts - I think you're right that most of this is obsoleted by #286, sorry about that and the delay responding. Comparing against main, it does look like your fix for the |
It's been too long, and I don't remember a whole lot, but it seems that the new generation process would necessitate me starting from scratch, and I'd have to rewrite the PR summary. At that point, why even bother saving this branch? Hopefully this PR will be of some use to someone who does want to re-update the example for |
Hello! My teammates and I were trying to get the
grpc
example to work, and were eventually able to figure out the things that needed to change to make its instructions, which seem to be around six years old, work with modern versions ofprotoc
and the related Golang tooling for it. We decided that not only should we update the.proto
file and generated code, we should also make sure that the two separate generated files (since there are two now, rather than one) get committed. In addition to that, we recorded some details in the README about how to find the versions of the software used to generate the code, for newbies to the codebase (like ourselves!) who didn't really know what was assumed about the development environment.The updates to the client required us to also regenerate the Python plugin code, so we updated that and made sure we spelled out the dependencies that were used for that language. We found that we did have to manually re-insert the copyright notices to the python code, but not the Golang code; if there's an option in the generation command that fixes that, then we'd love to know about it.
We felt that recording the versions of various software dependencies used would not only help orient new users, but it would also make it easier in the future, if
protoc
or related tools introduce more breaking changes, to figure out what needs to change to make the instructions keep working. This is our first time using both this plugin repo and gRPC in general, and we're not experts with Golang either, so it may read as unnecessarily redundant information to an experienced developer, so we apologize for that. Also, we may not have written idiomatic code, but we're happy to take feedback and make sure it is idiomatic.While we were at it, we also made the
net/rpc
example that lived in thegrpc
example's folder work. Before, it would fail with an error fromrpc_server.go
saying that it couldn't find the (hardcoded)kv_grpc
plugin, which makes sense since thenet/rpc
plugin doesn't define that for obvious reasons.And we also updated the
bidirectional
example since it's similar to thegrpc
example, plus we tested the other examples to ensure they still work, particularly thenegotiated
example which re-uses thegrpc
example's code. They all work on our machine, so hopefully they all work for you too.Now, probably the most important change here is not to the example, but rather the top-level
go.mod
dependencies. The thing is, we were struggling to get things to work unless we upgraded the gRPC and protobuf dependencies to match modern guides (such as this one ongrpc.io
) unless we updated those dependencies. We were really hesitant to proceed until we noticed that theterraform-plugin-go
repo uses the samegrpc
version and even a much more recentprotobuf
version, and if that repo is supposed to serve as a template or guide for people writing terraform plugins, and it's pretty married to gRPC, then upgrading would probably be fine. Also, our new generation instructions are based not only on those modern guides, but also how that repo generates its code too, so we felt pretty justified in our decisions after that. With that said, we understand that this repo is a dependency for many Hashicorp projects, so we're not sure whether we actually can upgrade those dependencies. Please let us know if we need to find a set of dependencies that will work for all consumers of this project.At any rate, this fixes #249.