首页 > 解决方案 > GoKit 和生成微服务安装协议错误

问题描述

错误告诉我这个

  1. 我已经下载了这些软件包。
  2. 仍然显示错误请先安装协议,然后重新运行命令
$ 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"

标签: apigo

解决方案


来自go-kit 源

一起使用 gRPC 和 go-kit 非常简单。

首先,使用 protobuf3 定义您的服务。这在 gRPC 文档中进行了解释。有关示例,请参见 add.proto。确保 proto 定义与您的服务的 go-kit(接口)定义相匹配。

接下来,获取 protoc 编译器。

您可以从 protobuf 发布页面下载预编译的二进制文件。您将解压缩一个名为 protoc3 的文件夹,其中包含一个包含可执行文件的子目录 bin。将该可执行文件移动到 $PATH 中的某个位置,您就可以开始了!

所以只要确保 protoc 在你的 PATH 环境变量中。


推荐阅读