api - GoKit 和生成微服务安装协议错误
问题描述
错误告诉我这个
- 我已经下载了这些软件包。
- 仍然显示错误请先安装协议,然后重新运行命令
$ kit generate service notifactor -t grpc --dmw
time="2019-03-06T16:35:29+08:00" level=error msg="Please install protoc first and than rerun the command"
time="2019-03-06T16:35:29+08:00" level=info msg="Install proto3.\nhttps://github.com/google/protobuf/releases\nUpdate protoc Go bindings via\n> go get -u github.com/golang/protobuf/proto\n> go get -u github.com/golang/protobuf/protoc-gen-go\n\nSee also\nhttps://github.com/grpc/grpc-go/tree/master/examples"
解决方案
来自go-kit 源:
一起使用 gRPC 和 go-kit 非常简单。
首先,使用 protobuf3 定义您的服务。这在 gRPC 文档中进行了解释。有关示例,请参见 add.proto。确保 proto 定义与您的服务的 go-kit(接口)定义相匹配。
接下来,获取 protoc 编译器。
您可以从 protobuf 发布页面下载预编译的二进制文件。您将解压缩一个名为 protoc3 的文件夹,其中包含一个包含可执行文件的子目录 bin。将该可执行文件移动到 $PATH 中的某个位置,您就可以开始了!
所以只要确保 protoc 在你的 PATH 环境变量中。
推荐阅读
- firebase-dynamic-links - Firebase 动态 URL 离线工作?
- java - 为了创建可运行的 jar,Maven application.properties 文件中应该包含什么?
- ios - IOS 11.3 通用应用部署错误:“无效捆绑。您的应用支持 iPad 上的多任务处理,因此您必须包含 UILaunchStoryboardName”
- javascript - 在 JavaScript 中解析的棘手日期字符串
- java - 无法从 php 执行 javac
- google-chrome - Chrome 设备模式 - 看不到视口控件
- python-2.7 - Python自动选择颜色条
- reactjs - this.forceUpdate() 不重新渲染动态创建的组件
- android - 将对象的嵌套数组列表从适配器传递到活动
- java - springboot打包为JAR时,ServletContextEvent.getServletContext返回null