{"id":43124,"date":"2024-12-01T12:45:42","date_gmt":"2024-12-01T04:45:42","guid":{"rendered":"https:\/\/fwq.ai\/blog\/43124\/"},"modified":"2024-12-01T12:45:42","modified_gmt":"2024-12-01T04:45:42","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8-ubuntu-%e4%b8%8a%e6%ad%a3%e7%a1%ae%e5%ae%89%e8%a3%85-protoc-gen-go%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/43124\/","title":{"rendered":"\u5982\u4f55\u5728 Ubuntu \u4e0a\u6b63\u786e\u5b89\u88c5 protoc-gen-go\uff1f"},"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>\u5982\u4f55\u5728 Ubuntu \u4e0a\u6b63\u786e\u5b89\u88c5 protoc-gen-go\uff1f<\/span><\/p>\n<h1>\u5982\u4f55\u5728 Ubuntu \u4e0a\u6b63\u786e\u5b89\u88c5 protoc-gen-go\uff1f<\/h1>\n<p><span>\u6765\u6e90\uff1astackoverflow<\/span><br \/>\n<span>2024-04-29 19:27:35<\/span><br \/>\n<span><i><\/i>0\u6d4f\u89c8<\/span><br \/>\n<span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>\u4eca\u5929\u7c73\u4e91\u7ed9\u5927\u5bb6\u5e26\u6765\u4e86<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u5982\u4f55\u5728 Ubuntu \u4e0a\u6b63\u786e\u5b89\u88c5 protoc-gen-go\uff1f\u300b<\/span>\uff0c\u5176\u4e2d\u6d89\u53ca\u5230\u7684\u77e5\u8bc6\u70b9\u5305\u62ec<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\uff0c\u65e0\u8bba\u4f60\u662f\u5c0f\u767d\u8fd8\u662f\u8001\u624b\uff0c\u90fd\u9002\u5408\u770b\u4e00\u770b\u54e6~\u6709\u597d\u7684\u5efa\u8bae\u4e5f\u6b22\u8fce\u5927\u5bb6\u5728\u8bc4\u8bba\u7559\u8a00\uff0c\u82e5\u662f\u770b\u5b8c\u6709\u6240\u6536\u83b7\uff0c\u4e5f\u5e0c\u671b\u5927\u5bb6\u80fd\u591a\u591a\u70b9\u8d5e\u652f\u6301\u5440\uff01\u4e00\u8d77\u52a0\u6cb9\u5b66\u4e60~<\/p>\n<p> \u95ee\u9898\u5185\u5bb9<br \/>\n <\/p>\n<p>\u6211\u6210\u529f\u5728 ubuntu \u4e0a\u4e0b\u8f7d\u5e76\u5b89\u88c5\u4e86 go\u3002\u4f46\u662f\uff0c\u6211\u76ee\u524d\u65e0\u6cd5\u6b63\u786e\u8bbe\u7f6e protoc-gen-go\uff0c\u56e0\u4e3a\u6211\u7684 gopath \u548c goroot \u672a\u6b63\u786e\u5b9a\u4e49\u3002\u8fd9\u662f\u6211\u7684 goroot \u548c gopath \u7684\u6837\u5b50\uff1a<\/p>\n<pre>export GOROOT=\/usr\/local\/go\nexport PATH=$PATH:$GOROOT\/bin\nexport GOPATH=$HOME\/go\nexport GOBIN=$GOPATH\/bin\nexport PATH=$PATH:$GOROOT:$GOPATH:$GOBIN\nexport PATH=\"$PATH:$HOME\/.local\/bin\"\nexport PATH=$PATH:$GOPATH\/bin\nexport GO_PATH=~\/go\nexport PATH=$PATH:\/$GO_PATH\/bin<\/pre>\n<p> <\/p>\n<h2>\u89e3\u51b3\u65b9\u6848<\/h2>\n<p> <\/p>\n<p>\u5c1d\u8bd5\u5220\u9664\u6240\u6709\u8fd9\u4e9b\u884c\uff0c\u5e76\u5c06\u5b83\u4eec\u66ff\u6362\u4e3a\uff1a<\/p>\n<pre>#export GOROOT=\/usr\/local\/go # this should not be needed\nexport GOPATH=$HOME\/go\nexport GOBIN=$GOPATH\/bin\nexport PATH=$PATH:$GOROOT:$GOPATH:$GOBIN<\/pre>\n<p>\u4e0d\u9700\u8981\u591a\u6b21\u5bfc\u51fa path..<\/p>\n<p>\u5728 <code>export go_path=~\/go<\/code> \u4e2d\u4f7f\u7528 <code>~<\/code> \u4e5f\u53ef\u80fd\u4f1a\u5bfc\u81f4\u95ee\u9898\u3002<\/p>\n<p>\u5c06\u8fd9\u4e9b\u884c\u6dfb\u52a0\u5230 <code>.bashrc<\/code> \u540e\uff0c\u91cd\u65b0\u52a0\u8f7d\u7ec8\u7aef\uff0c\u6216\u5728\u7ec8\u7aef\u4e2d\u6267\u884c\u8fd9\u4e9b\u76f8\u540c\u7684\u884c\uff0c\u4ee5\u4fbf\u5b83\u4eec\u751f\u6548\u3002<\/p>\n<p>\u6587\u4e2d\u5173\u4e8e\u7684\u77e5\u8bc6\u4ecb\u7ecd\uff0c\u5e0c\u671b\u5bf9\u4f60\u7684\u5b66\u4e60\u6709\u6240\u5e2e\u52a9\uff01\u82e5\u662f\u53d7\u76ca\u532a\u6d45\uff0c\u90a3\u5c31\u52a8\u52a8\u9f20\u6807\u6536\u85cf\u8fd9\u7bc7\u300a\u5982\u4f55\u5728 Ubuntu \u4e0a\u6b63\u786e\u5b89\u88c5 protoc-gen-go\uff1f\u300b\u6587\u7ae0\u5427\uff0c\u4e5f\u53ef\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u4e86\u89e3\u76f8\u5173\u6280\u672f\u6587\u7ae0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u524d\u4f4d\u7f6e\uff1a &gt; &gt; &gt; &gt; \u5982\u4f55\u5728 Ubuntu \u4e0a\u6b63\u786e\u5b89\u88c5 protoc-gen-go\uff1f \u5982\u4f55\u5728 Ubuntu \u4e0a\u6b63\u786e\u5b89\u88c5 protoc-gen-go\uff1f \u6765\u6e90\uff1astackoverflow 2024-04-29 19:27:35 0\u6d4f\u89c8 \u6536\u85cf \u4eca\u5929\u7c73\u4e91\u7ed9\u5927\u5bb6\u5e26\u6765\u4e86\u300a\u5982\u4f55\u5728 Ubuntu \u4e0a\u6b63\u786e\u5b89\u88c5 protoc-gen-go\uff1f\u300b\uff0c\u5176\u4e2d\u6d89\u53ca\u5230\u7684\u77e5\u8bc6\u70b9\u5305\u62ec\u7b49\u7b49\uff0c\u65e0\u8bba\u4f60\u662f\u5c0f\u767d\u8fd8\u662f\u8001\u624b\uff0c\u90fd\u9002\u5408\u770b\u4e00\u770b\u54e6~\u6709\u597d\u7684\u5efa\u8bae\u4e5f\u6b22\u8fce\u5927\u5bb6\u5728\u8bc4\u8bba\u7559\u8a00\uff0c\u82e5\u662f\u770b\u5b8c\u6709\u6240\u6536\u83b7\uff0c\u4e5f\u5e0c\u671b\u5927\u5bb6\u80fd\u591a\u591a\u70b9\u8d5e\u652f\u6301\u5440\uff01\u4e00\u8d77\u52a0\u6cb9\u5b66\u4e60~ \u95ee\u9898\u5185\u5bb9 \u6211\u6210\u529f\u5728 ubuntu \u4e0a\u4e0b\u8f7d\u5e76\u5b89\u88c5\u4e86 go\u3002\u4f46\u662f\uff0c\u6211\u76ee\u524d\u65e0\u6cd5\u6b63\u786e\u8bbe\u7f6e protoc-gen-go\uff0c\u56e0\u4e3a\u6211\u7684 gopath \u548c goroot \u672a\u6b63\u786e\u5b9a\u4e49\u3002\u8fd9\u662f\u6211\u7684 goroot \u548c gopath \u7684\u6837\u5b50\uff1a export GOROOT=\/usr\/local\/go export PATH=$PATH:$GOROOT\/bin export GOPATH=$HOME\/go export GOBIN=$GOPATH\/bin export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN export PATH=&#8221;$PATH:$HOME\/.local\/bin&#8221; export PATH=$PATH:$GOPATH\/bin export GO_PATH=~\/go export PATH=$PATH:\/$GO_PATH\/bin \u89e3\u51b3\u65b9\u6848 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-43124","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/43124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=43124"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/43124\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=43124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=43124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=43124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}