When I am building a proto (with grpc enabled) using bazel, I am getting this error message:
undefined: grpc.SupportPackageIsVersion4.
The reason for this error seems to be:
org_golang_google_api, com_google_cloud_go, com_github_googleapis_gax_go}, whose HEADs contain protos built with grpc.SupportPackageIsVersion3.com_github_golang_protobuf, which is using grpc.SupportPackageIsVersion4.Is there anyway to handle this issue?
Thanks.
Multiple people have had this issue. So far it hasn't really been addressed to a satisfactory solution IMHO.
For those who want to fix this issue temporarily, I have fixed it by following these steps:
Change generatedCodeVersion from 4 to 3
$ cd $GOPATH/src/github.com/golang/protobuf/protoc-gen-go
$ vi grpc/grpc.go
// generatedCodeVersion indicates a version of the generated code.
// It is incremented whenever an incompatibility between the generated code and
// the grpc package is introduced; the generated code references
// a constant, grpc.SupportPackageIsVersionN (where N is generatedCodeVersion).
const generatedCodeVersion = 3
Recompile protoc-gen-go
# cd $GOPATH/src/github.com/golang/protobuf/protoc-gen-go
$ go install
Now use protoc as normal
Fundamentally, the Go ecosystem needs a proper dependency management system, which is finally in the works. The proper approach to this issue is proper version tagging. Closing this in favor of #328
Most helpful comment
For those who want to fix this issue temporarily, I have fixed it by following these steps:
Change
generatedCodeVersionfrom4to3Recompile
protoc-gen-goNow use
protocas normal