{"id":206957,"date":"2025-07-08T09:38:52","date_gmt":"2025-07-08T01:38:52","guid":{"rendered":"https:\/\/server.hk\/cnblog\/206957\/"},"modified":"2025-07-08T09:38:52","modified_gmt":"2025-07-08T01:38:52","slug":"gokit%e5%92%8c%e7%94%9f%e6%88%90%e5%be%ae%e6%9c%8d%e5%8a%a1%e5%ae%89%e8%a3%85%e5%8d%8f%e8%ae%ae%e9%94%99%e8%af%af","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/206957\/","title":{"rendered":"GoKit\u548c\u751f\u6210\u5fae\u670d\u52a1\u5b89\u88c5\u534f\u8bae\u9519\u8bef"},"content":{"rendered":"<p><b><\/b> <\/p>\n<p>\u5f53\u524d\u4f4d\u7f6e\uff1a <span>&gt;<\/span> <span>&gt;<\/span> <span>&gt;<\/span> <span>&gt;<\/span> <span>GoKit\u548c\u751f\u6210\u5fae\u670d\u52a1\u5b89\u88c5\u534f\u8bae\u9519\u8bef<\/span><\/p>\n<p><span>\u6765\u6e90\uff1astackoverflow<\/span><br \/>\n<span>2024-04-19 08:03:34<\/span><br \/>\n<span><i><\/i>0\u6d4f\u89c8<\/span><br \/>\n<span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>\u4ece\u73b0\u5728\u5f00\u59cb\uff0c\u52aa\u529b\u5b66\u4e60\u5427\uff01\u672c\u6587<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aGoKit\u548c\u751f\u6210\u5fae\u670d\u52a1\u5b89\u88c5\u534f\u8bae\u9519\u8bef\u300b<\/span>\u4e3b\u8981\u8bb2\u89e3\u4e86<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u76f8\u5173\u77e5\u8bc6\u70b9\uff0c\u6211\u4f1a\u5728\u4e2d\u6301\u7eed\u66f4\u65b0\u76f8\u5173\u7684\u7cfb\u5217\u6587\u7ae0\uff0c\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u5e76\u79ef\u6781\u7559\u8a00\u5efa\u8bae\u3002\u4e0b\u9762\u5c31\u5148\u4e00\u8d77\u6765\u770b\u4e00\u4e0b\u672c\u7bc7\u6b63\u6587\u5185\u5bb9\u5427\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u4f60\uff01<\/p>\n<p> \u95ee\u9898\u5185\u5bb9<br \/>\n <\/p>\n<p>\u9519\u8bef\u5411\u6211\u5c55\u793a\u4e86\u8fd9\u4e00\u70b9<\/p>\n<p> \u6211\u5df2\u7ecf\u4e0b\u8f7d\u4e86\u8fd9\u4e9b\u8f6f\u4ef6\u5305\u3002 \u4ecd\u7136\u663e\u793a\u9519\u8bef \u8bf7\u5148\u5b89\u88c5 protoc \u7136\u540e\u91cd\u65b0\u8fd0\u884c\u547d\u4ee4 <\/p>\n<pre>$ kit generate service notifactor -t grpc --dmw\ntime=\"2019-03-06T16:35:29+08:00\" level=error msg=\"Please install protoc first and than rerun the command\"\ntime=\"2019-03-06T16:35:29+08:00\" level=info msg=\"Install proto3.\\nhttps:\/\/github.com\/google\/protobuf\/releases\\nUpdate protoc Go bindings via\\n&gt; go get -u github.com\/golang\/protobuf\/proto\\n&gt; go get -u github.com\/golang\/protobuf\/protoc-gen-go\\n\\nSee also\\nhttps:\/\/github.com\/grpc\/grpc-go\/tree\/master\/examples\"<\/pre>\n<p> <\/p>\n<h2>\u89e3\u51b3\u65b9\u6848<\/h2>\n<p> <\/p>\n<p>\u6765\u81ea\uff1a<\/p>\n<p>\u4e00\u8d77\u4f7f\u7528 gRPC \u548c go-kit \u975e\u5e38\u7b80\u5355\u3002<\/p>\n<p>\u9996\u5148\uff0c\u4f7f\u7528 protobuf3 \u5b9a\u4e49\u60a8\u7684\u670d\u52a1\u3002 gRPC \u6587\u6863\u5bf9\u6b64\u8fdb\u884c\u4e86\u89e3\u91ca\u3002\u6709\u5173\u793a\u4f8b\uff0c\u8bf7\u53c2\u9605 add.proto\u3002\u786e\u4fdd\u539f\u578b\u5b9a\u4e49 \u4e0e\u60a8\u7684\u670d\u52a1\u7684 go-kit\uff08\u63a5\u53e3\uff09\u5b9a\u4e49\u5339\u914d\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u83b7\u53d6\u534f\u8bae\u7f16\u8bd1\u5668\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u4ece protobuf \u53d1\u5e03\u9875\u9762\u4e0b\u8f7d\u9884\u7f16\u8bd1\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u3002\u60a8\u5c06\u89e3\u538b\u7f29\u4e00\u4e2a\u540d\u4e3a protoc3 \u7684\u6587\u4ef6\u5939\uff0c\u5176\u4e2d\u5305\u542b\u4e00\u4e2a\u5305\u542b\u53ef\u6267\u884c\u6587\u4ef6\u7684\u5b50\u76ee\u5f55 bin\u3002\u5c06\u8be5\u53ef\u6267\u884c\u6587\u4ef6\u79fb\u81f3 $PATH \u4e2d\u7684\u67d0\u4e2a\u4f4d\u7f6e\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u5f00\u59cb\u4e86\uff01<\/p>\n<p>\u6240\u4ee5\u53ea\u8981\u786e\u4fdd protoc \u5728\u4f60\u7684 PATH \u73af\u5883\u53d8\u91cf\u4e2d\u5373\u53ef\u3002<\/p>\n<p>\u597d\u4e86\uff0c\u672c\u6587\u5230\u6b64\u7ed3\u675f\uff0c\u5e26\u5927\u5bb6\u4e86\u89e3\u4e86\u300aGoKit\u548c\u751f\u6210\u5fae\u670d\u52a1\u5b89\u88c5\u534f\u8bae\u9519\u8bef\u300b\uff0c\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01\u5173\u6ce8\u516c\u4f17\u53f7\uff0c\u7ed9\u5927\u5bb6\u5206\u4eab\u66f4\u591aGolang\u77e5\u8bc6\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u524d\u4f4d\u7f6e\uff1a &gt; &gt; &#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-206957","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/206957","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=206957"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/206957\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=206957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=206957"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=206957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}