Search code examples
goprotocol-buffersprotoc

protoc-gen-go specific version require


I need a pre build project and I need a version of protoc-gen-go v1.25.0-devel but I am unable to find command etc to install It , till now I tried to do something like this :

go get -u google.golang.org/protobuf/cmd/protoc-gen-go@v1.25.0-devel

and I am getting this ERROR invalid version: unknown revision cmd/protoc-gen-go/v1.25.0-devel

Is there any way to get this version ?


Solution

  • If you're following this post to create a sample service, you don't need the specific version 1.25.0-devel that appears in the generated files. You should use the latest stable version (currently v1.26.0). Since it is an minor version upgrade, there should be no breaking changes between versions. One thing that you may need to make the examples in the post to work is that you should set the package for the generated code. You can set it in the .proto file as an option, for example option go_package = grpc-example/generated/protos/calc or as a command line argument for the protoc command, for example protoc ...OTHER_OPTS --go_opt=Mprotos/calc.proto=grpc-example/generated/protos/calc.

    If you are sure that you absolutely need the specific version v1.25.0-devel you can install the plugin pointing to a specific commit (as that version is not currently available as a tag/branch name). If you're using go 1.16.x you can use go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@a9513eb pointing at this commit. For older go versions, use go get