protocol-buffers - protobuf 导入 google/protobuf/timestamp.proto
问题描述
我的原型文件是:
syntax = "proto3";
import "google/protobuf/timestamp.proto";
service Foo {
rpc now(NowRequest) returns (NowResponse) {}
}
message NowRequest {}
message NowResponse {
google.protobuf.Timestamp now = 1;
}
我生成代码的命令和产生的错误是:
protoc foo.proto --go_out=plugins=grpc,import_path=proto:internal/proto
foo.proto:3:1: Import "google/protobuf/timestamp.proto" was not found or had errors.
foo.proto:12:3: "google.protobuf.Timestamp" is not defined.
我的协议版本是:
protoc --version
libprotoc 3.11.3
我已遵循本指南并查看了此问题。如何导入众所周知的类型?我需要下载其他东西吗?我如何知道我当前安装的确切众所周知的类型是什么?谢谢你。
解决方案
“google/protobuf/timestamp.proto”存储在路径中:/usr/local/include/google/protobuf
请检查您是否有 /usr/local/include/google/protobuf 目录。
如果不是,这意味着 protobuf 安装有错误。请追溯所遵循的安装步骤或尝试重新安装。
请在此处找到更多帮助:https ://github.com/grpc-ecosystem/grpc-gateway/issues/422
推荐阅读
- c# - 提供动态 sitemap.xml 内容
- c# - 如何在 WPF 中删除按钮上的悬停效果
- angular - Angular 7,验证 FormArray 中动态创建的复选框组
- firebase - Firebase Firestore 未显示由我的颤振应用程序创建的文档
- java - 有人可以解释为什么 forEach 循环中的分配对象在退出 forEach 循环时变为 null 吗?
- css - 如何响应地连接两个 div 与一条线?
- python - 烧瓶请求处理程序中使用的模拟函数
- c# - 空表项目因访问冲突而停止
- scala - 使用 sbt publishLocal 时,自定义配置 src jar 在 jars 文件夹中而不是 srcs 中结束
- javascript - 在javascript中组合两个对象