go : 执行protoc -I . helloworld.proto --go_out=plugins=grpc:.时出现问题

2022/1/24 23:35:00

本文主要是介绍go : 执行protoc -I . helloworld.proto --go_out=plugins=grpc:.时出现问题,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

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;
}


这篇关于go : 执行protoc -I . helloworld.proto --go_out=plugins=grpc:.时出现问题的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程