preface
Execute the following command in the proto folder:
$ protoc --go_out=plugins=grpc:. *.proto
Error: unable to determine the go import path
protoc-gen-go: unable to determine Go import path for "search.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 informa
tion.
--go_out: protoc-gen-go: Plugin failed with status code 1.
Solution:
Specify the path in all .Proto
files
option go_package ="./pb";
Example: the third sentence code is added to the proto file
syntax = "proto3";
package proto;
option go_package ="./proto"; // Specify the RPC file generation path address
service SearchService {
rpc Search(SearchRequest) returns (SearchResponse) {}
}
message SearchRequest {
string request = 1;
}
message SearchResponse {
string response = 1;
}
Similar Posts:
- [Solved] –go_out: protoc-gen-go: Plugin failed with status code 1.
- Error message added by protobuf: type already exists
- [How to Solve] protoc: Command not found
- [Solved] Protobuf & cmake Low Version Error: Could not find a package configuration file provided by “Protobuf” with any of the following names: ProtobufConfig.cmake
- Go Language compilation and installation protobuf: protoc-gen-go: program not found or is not executable
- [Solved] Hits[] of ElasticSearch SearchResponse is always one less record than totalHits
- C# proto Import Files Error: File not found. Import “common.proto” was not found or had errors.
- ImportError: No module named caffe.proto [How to Solve]
- C Language: How to Search in Header File (Two Methods)
- ModuleNotFoundError No module named urllib2