1, unable to determine Go import path for "kv.proto"
protoc --go_out=. --go-grpc_out=. --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative kv.proto
protoc-gen-go: unable to determine Go import path for "kv.proto"
Please specify either:
• a "go_package" option in the .proto source file, or
• a "M" argument on the command line.
See https://developers.google.com/protocol-buffers/docs/reference/go-generated#package for more information.
--go_out: protoc-gen-go: Plugin failed with status code 1.
解决办法:IDL问价添加option go_package
option go_package ="pb/pbraft";
2,生成的方法不是大写,可以不生成UnimplementedXXXServer:链接require_unimplemented_servers=false
protoc --go_out=. --go-grpc_out=require_unimplemented_servers=false:. --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative kv.proto
还有种办法时把这个 pb.UnimplementedXXXServer引入作为struct的一部分
type ShardKv struct {
C chan InputChannelType
store map[string]string
valid map[string]bool
currConfig int64
pb.UnimplementedShardKvServer
}