Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protoc... missing UnimplementedGreeterServer #3670

Closed
JCzz opened this issue Jun 9, 2020 · 3 comments
Closed

protoc... missing UnimplementedGreeterServer #3670

JCzz opened this issue Jun 9, 2020 · 3 comments

Comments

@JCzz
Copy link

JCzz commented Jun 9, 2020

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

@dfawley
Copy link
Member

dfawley commented Jun 11, 2020

@JCzz what version of protoc-gen-go are you running? The Unimplemented servers were not generated until golang/protobuf#785, released in 1.3.2.

@JCzz
Copy link
Author

JCzz commented Jun 11, 2020

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.

@JCzz
Copy link
Author

JCzz commented Jun 12, 2020

Hi @dfawley
Thanks for pointing me to upgrading, I should have thought of that - it worked!

@JCzz JCzz closed this as completed Jun 12, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants