I am new to grpc. In my go.mod
file I have:
google.golang.org/genproto v0.0.0-20190508193815-b515fa19cec8
google.golang.org/grpc v1.21.1
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d
github.com/golang/protobuf v1.3.2
I am generating my protobufs like this:
go get google.golang.org/protobuf/cmd/protoc-gen-go
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
protoc --go_out=. --go-grpc_out=. ./me.proto
I get the following errors when I try to run tests and build:
me_grpc.pb.go:15:11: undefined: grpc.SupportPackageIsVersion7
me_grpc.pb.go:25:5: undefined: grpc.ClientConnInterface
me_grpc.pb.go:28:30: undefined: grpc.ClientConnInterface
me_grpc.pb.go:65:34: undefined: grpc.ServiceRegistrar
I figured out that switching SupportPackageIsVersion7
to SupportPackageIsVersion5
makes gopls happy but I have no idea what I need to do in order to make the other errors go away. Unfortunately, I am stuck at the versions of the libraries in my go.mod file due to other things in my repo that fail to compile if I try to upgrade those libraries.
replace (
github.com/coreos/etcd => github.com/ozonru/etcd v3.3.20-grpc1.27-origmodule+incompatible
google.golang.org/grpc => google.golang.org/grpc v1.27.0
)
in go.mod should help