1

I had been compiling files with protoc-gen-go and everything went ok, but then i reinstalled Ubuntu, installed protoc again and getting this with same script instead of file:

command:

protoc -I . myfile.proto --go_out=plugins=grpc:protofiles

and error:

--go_out: protoc-gen-go: plugins are not supported; use 'protoc --go-grpc_out=...' to generate gRPC

See https://grpc.io/docs/languages/go/quickstart/#regenerate-grpc-code for more information.`

I was trying to compile with flag require_unimplemented_servers=false , but it generates some other code, not compatible to previous version.

xmm_581
  • 31
  • 4
  • Afaik `plugins=grpc:protofiles` isn't supported anymore for `go_out`. Instead, you have to use `protoc -I . myfile.proto --go_out=${YOUR_PATH} --go-grpc_out=${YOUR_PATH}`. Maybe [this](https://stackoverflow.com/a/71791499/5767484) helps for a deeper understanding. – NotX Jan 16 '23 at 15:57
  • I tried to use go-grpc_out, but the code was differentely generated, missing service interface for some reasons, only client interface. Maybe there some way to use old version – xmm_581 Jan 16 '23 at 18:41
  • You need an older version of `go-grpc_out` then. Maybe [this](https://stackoverflow.com/a/63905093/5767484) helps. But in general I'ld recommend you to go with the newer version and adjust things accordingly. Otherwise it will be hard to catch up in the future. – NotX Jan 16 '23 at 19:14
  • Btw. you should get both, client and server code: https://grpc.io/docs/languages/go/basics/#generating-client-and-server-code – NotX Jan 16 '23 at 19:30
  • Yes, i get client and server code with 2 files like in this example, but it is not compatible with my codebase. I fixed the problem by deleting protoc-gen-go from gopath/bin and by retrieving the github version of protoc-gen-go `go install github.com/golang/protobuf/protoc-gen-go@latest`. And it is worked with my old protobuf compile script which has no --go-grpc_out option. https://github.com/golang/protobuf/issues/1070 - This explains that old api v1 is outdated. – xmm_581 Jan 17 '23 at 10:03
  • Great to hear that it worked: But keep in mind that they recommend a switch even in this very issue: https://github.com/golang/protobuf/issues/1070#issuecomment-889309576 – NotX Jan 17 '23 at 10:49

0 Answers0