E:\Go\go\src\OldPackageTest\grpc_test\proto>protoc -I . helloworld.proto --go_out=plugins=grpc:./ protoc-gen-go: invalid Go import path "." for "helloworld.proto" The import path must contain at least one forward slash ('/') character. See https://developers.google.com/protocol-buffers/docs/reference/go-generated#package for more informat ion. --go_out: protoc-gen-go: Plugin failed with status code 1.
在proto文件头部将option go_package = ".;proto";改为option go_package = "./;proto";即可解决
syntax = "proto3"; option go_package = "./;proto"; // The greeting service definition. service Greeter { // Sends a greeting rpc SayHello (HelloRequest) returns (HelloReply); } // The request message containing the user's name. message HelloRequest { string name = 1; } // The response message containing the greetings message HelloReply { string message = 1; }