-1

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 ?

TNN
  • 391
  • 1
  • 5
  • 12
  • There is no such version as v1.25.0-devel. Check the available releases here https://github.com/protocolbuffers/protobuf-go/tags. I ran `go get google.golang.org/protobuf/cmd/protoc-gen-go@v1.25.0` and it works correctly – Pablo Flores Mar 19 '21 at 07:37
  • @PabloFlores I need `v1.25.0-devel` not `v1.25.0` – TNN Mar 19 '21 at 07:44
  • There are no tags nor branches with that name available, you're not going to get that specific version. You can try to point to a specific commit though – Pablo Flores Mar 19 '21 at 07:53
  • @PabloFlores who he is working by using this ? https://dev.to/greenteabiscuit/mini-grpc-project-creating-a-simple-increment-api-on-go-6cn – TNN Mar 19 '21 at 09:33
  • The person who wrote the post never specified any particular version for the protoc-gen-go package, it could be that `go get` downloaded the latest package available at the time or the one in their go mod cache. Try using the latest version – Pablo Flores Mar 19 '21 at 10:35

1 Answers1

1

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

Pablo Flores
  • 1,350
  • 13
  • 15