Grpc-go: protoc... missing UnimplementedGreeterServer

Created on 9 Jun 2020  路  3Comments  路  Source: grpc/grpc-go

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

Requires Reporter Clarification Question

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.

All 3 comments

@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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

liudanking picture liudanking  路  3Comments

HeinOldewageRetro picture HeinOldewageRetro  路  4Comments

aburluka picture aburluka  路  3Comments

kushp picture kushp  路  4Comments

arcana261 picture arcana261  路  3Comments