Env:
os: macos
protoc --version
libprotoc 3.12.3 // installed via brew
From sample code, why is the following not generating(UnimplementedGreeterServer is missing)?:
protoc --proto_path=. --go_out=plugins=grpc:. --go_opt=paths=source_relative helloworld.proto
// UnimplementedGreeterServer should be embedded to have forward compatible implementations.
type UnimplementedGreeterServer struct {
}
func (*UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented")
}
Also; from this example, there are bouth a pb.go and a grpc.pb.go file?
Error when including pb.UnimplementedGreeterServer as it does not exist:
type server struct {
pb.UnimplementedGreeterServer
}
undefined: helloworld.UnimplementedGreeterServer
@JCzz what version of protoc-gen-go are you running? The Unimplemented servers were not generated until https://github.com/golang/protobuf/pull/785, released in 1.3.2.
Thanks @dfawley
Good point - just tried protoc-gen-go --version but it just hangs no output.
I will try to upgrade first thing in the morning, running late on dk time.
Hi @dfawley
Thanks for pointing me to upgrading, I should have thought of that - it worked!
Most helpful comment
@JCzz what version of protoc-gen-go are you running? The Unimplemented servers were not generated until https://github.com/golang/protobuf/pull/785, released in 1.3.2.