Fix --go_out: protoc-gen-go: plugins are not supported

Summary

When generating Go RPC code, developers might encounter a "protoc-gen-go: plugins are not supported" error, often due to an outdated `protoc-gen-go` version. To resolve this, one approach is to adopt the recommended `protoc --go-grpc_out=...` command for gRPC code generation, aligning with current best practices. Alternatively, installing the GitHub version of `protoc-gen-go` via `go get github.com/golang/protobuf/protoc-gen-go` can fix the issue by providing plugin support. This ensures successful RPC code generation.

When generating RPC code using proto file template in GoLang, one may face the issue like below when running the command protoc.

Error: exit status 1
Output: --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.

Normally this issue is caused because the version of protoc-gen-go being used is not correct. One way to fix the issue is to follow the instructions provided by Google to run a new command.

Another way to fix this is by having the Github version of protoc-gen-go which does support the plugin, to install that, run below command.

go get github.com/golang/protobuf/protoc-gen-go

After this, above issue should be fixed.

PLUGIN GOLANG PROTO BUFFER

  RELATED

  COMMENTS

0

No comment for this article.