{"id":10006934,"date":"2022-11-29T14:11:53","date_gmt":"2022-11-29T06:11:53","guid":{"rendered":"https:\/\/ityet.com\/?p=10006934"},"modified":"2022-11-29T14:11:53","modified_gmt":"2022-11-29T06:11:53","slug":"segmentfault-%e6%80%9d%e5%90%a6%e6%8a%80%e6%9c%af%e5%91%a8%e5%88%8a-vol-71-%e8%a7%a3%e8%af%bb-go-%e8%af%ad%e8%a8%80","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10006934","title":{"rendered":"SegmentFault \u601d\u5426\u6280\u672f\u5468\u520a Vol.71 \u2014 \u89e3\u8bfb Go \u8bed\u8a00"},"content":{"rendered":"<p>\u521a\u521a\u7ed3\u675f\u7684\u5173\u4e8e\u300cGo\u300d\u8bed\u8a00\u7684\u6280\u672f\u5f81\u6587\u6d3b\u52a8\uff0c\u53c2\u4e0e\u6d3b\u52a8\u7684\u521b\u4f5c\u8005\u4eec\uff0c\u64b0\u5199\u4e86\u5f88\u591a\u4f18\u8d28\u6280\u672f\u5185\u5bb9\uff0c\u672c\u671f\u5468\u520a\u505a\u4e86\u6c47\u603b\uff0c\u6b22\u8fce\u5927\u5bb6\u4e00\u8d77\u9605\u8bfb\uff5e<\/p>\n<p>\u672c\u7bc7\u6587\u7ae0\u8f83\u957f\uff0c\u5efa\u8bae\u6536\u85cf\u540e\u6162\u6162\u9605\u8bfb\uff5e<\/p>\n<h2><code>\u6587\u7ae0\u63a8\u8350<\/code><\/h2>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042835130\">\u3010Go \u5fae\u670d\u52a1\u3011\u5f00\u53d1 gRPC \u603b\u5171\u5206\u4e09\u6b65<\/a> \/\/ \u738b\u4e2d\u9633 Go <\/strong><\/p><\/blockquote>\n<p>\u901a\u8fc7\u8fd9\u7bc7\u6587\u7ae0\u6211\u4eec\u5df2\u7ecf\u638c\u63e1\u4e86 gRPC \u76f8\u5173\u7684\u77e5\u8bc6\u70b9\uff0c\u53ef\u4ee5\u72ec\u7acb\u7528 Go \u5b9e\u73b0\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef\u7684\u7f16\u5199\uff0c\u5e76\u4e14\u901a\u8fc7\u670d\u52a1\u6ce8\u518c\u5bf9\u5916\u63d0\u4f9b\u670d\u52a1\uff0c\u5b9e\u73b0\u53ef\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef\u7684 gRPC \u901a\u4fe1\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042764979\">\u3010Go \u5fae\u670d\u52a1\u3011\u4e00\u6587\u5e26\u4f60\u73a9\u8f6c ProtoBuf<\/a> \/\/ \u738b\u4e2d\u9633 Go <\/strong><\/p><\/blockquote>\n<p>\u5728\u7f51\u7edc\u901a\u4fe1\u548c\u901a\u7528\u6570\u636e\u4ea4\u6362\u7b49\u5e94\u7528\u573a\u666f\u4e2d\u7ecf\u5e38\u4f7f\u7528\u7684\u6280\u672f\u662f JSON \u6216 XML\uff0c\u5728\u5fae\u670d\u52a1\u67b6\u6784\u4e2d\u901a\u5e38\u4f7f\u7528\u53e6\u5916\u4e00\u4e2a\u6570\u636e\u4ea4\u6362\u7684\u534f\u8bae\u7684\u5de5\u5177 ProtoBuf\u3002<br \/>ProtoBuf \u4e5f\u662f\u6211\u4eec\u505a\u5fae\u670d\u52a1\u5f00\u53d1\uff0c\u8fdb\u884c Go \u8fdb\u9636\u5b9e\u6218\u4e2d\uff0c\u5fc5\u77e5\u5fc5\u4f1a\u7684\u77e5\u9053\u70b9\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042800509\">PHP \u8f6c GO \u5fc5\u770b\uff1a\u4e3a\u4ec0\u4e48\u6211\u89c9\u5f97 GoFrame \u7684 garray \u6bd4 PHP \u7684 array \u8fd8\u597d\u7528\uff1f<\/a> \/\/ \u738b\u4e2d\u9633 Go <\/strong><\/p><\/blockquote>\n<p>\u5728\u5b66\u4e60 Go \u57fa\u7840\u77e5\u8bc6\u7684\u65f6\u5019\u4e86\u89e3\u5230 Go \u7684\u6570\u7ec4\u548c PHP \u7684\u6570\u7ec4\u5e76\u4e0d\u4e00\u6837\uff1b\u4ece\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u8bb2\uff0cGo\u7684 slice \u5207\u7247\u7c7b\u578b\u548c PHP \u7684\u6570\u7ec4 array \u6bd4\u8f83\u50cf\uff08\u4e0d\u56fa\u5b9a\u957f\u5ea6\u3001\u5f15\u7528\u7c7b\u578b\u3001\u52a8\u6001\u6269\u5bb9\u7b49\uff09\uff0c\u4f46\u662f\u5728\u5f00\u53d1\u4f7f\u7528\u4e2d\u8fdc\u8fdc\u4e0d\u50cf PHP \u7684 array \u7075\u6d3b\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042847296\">\u901a\u8fc7\u9605\u8bfb\u6e90\u7801\u89e3\u51b3\u9879\u76ee\u96be\u9898\uff1aGToken \u66ff\u6362 JWT \u5b9e\u73b0 SSO \u5355\u70b9\u767b\u5f55<\/a> \/\/ \u738b\u4e2d\u9633 Go <\/strong><\/p><\/blockquote>\n<p>\u4eca\u5929\u548c\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\u4f7f\u7528 GoFrame \u7684 gtoken \u66ff\u6362 jwt \u5b9e\u73b0 sso \u767b\u5f55\u7684\u7ecf\u9a8c\u3002\u671f\u95f4\u6211\u4e5f\u8e29\u4e86\u4e00\u4e9b\u5751\uff0c\u6700\u7ec8\u662f\u901a\u8fc7\u9605\u8bfb\u6e90\u7801\u89e3\u51b3\u4e86\u9879\u76ee\u4e2d\u9047\u5230\u7684\u95ee\u9898\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042910744\">\u4e09\u5206\u949f\u5b66\u4f1a go \u8bed\u8a00\u7684\u53d8\u91cf\u5b9a\u4e49<\/a> \/\/ \u5915\u6c34<\/strong><\/p><\/blockquote>\n<p>\u7279\u522b\u8bf4\u660e: \u672c\u6587\u53ea\u9002\u5408\u65b0\u624b\u5b66\u4e60\uff0c\u8fd9\u7bc7\u6587\u7ae0\u5e26\u6211\u4eec\u5165\u95e8 go \u8bed\u8a00\u7684\u5b9a\u4e49\u53d8\u91cf\u7684\u65b9\u5f0f\uff0c\u5176\u5b9e\u548c javascript \u5f88\u76f8\u4f3c\uff0c\u6240\u4ee5\u7279\u610f\u603b\u7ed3\u5728\u6b64\u3002<br \/>\u5728 go \u8bed\u8a00\u4e2d\uff0c\u4e5f\u6709\u53d8\u91cf\u548c\u5e38\u91cf\u4e24\u79cd\uff0c\u9996\u5148\u6211\u4eec\u6765\u770b\u53d8\u91cf\u7684\u5b9a\u4e49\uff0c\u5b9a\u4e49\u53d8\u91cf\u6211\u4eec\u5206\u4e3a\u5b9a\u4e49\u5355\u4e2a\u53d8\u91cf\u548c\u591a\u4e2a\u53d8\u91cf\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042825269\">\u524d\u7aef\u5982\u4f55\u5165\u95e8 Go \u8bed\u8a00<\/a> \/\/ robin <\/strong><\/p><\/blockquote>\n<p>\u7c7b\u6bd4\u6cd5\u662f\u4e00\u79cd\u5b66\u4e60\u65b9\u6cd5\uff0c\u5b83\u662f\u901a\u8fc7\u5c06\u65b0\u77e5\u8bc6\u4e0e\u5df2\u77e5\u77e5\u8bc6\u8fdb\u884c\u6bd4\u8f83\uff0c\u4ece\u800c\u52a0\u6df1\u5bf9\u65b0\u77e5\u8bc6\u7684\u7406\u89e3\u3002\u5728\u5b66\u4e60 Go \u8bed\u8a00\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6211\u53d1\u73b0\uff0c\u901a\u8fc7\u7c7b\u6bd4\u5df2\u6709\u7684\u524d\u7aef\u77e5\u8bc6\uff0c\u53ef\u4ee5\u66f4\u597d\u5730\u7406\u89e3 Go \u8bed\u8a00\u7684\u7279\u6027\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042756262\">Go \u5fae\u670d\u52a1\u5b9e\u6218\u4e4b\u5982\u4f55\u4f7f\u7528 go-micro \u5199\u5fae\u670d\u52a1\u5e94\u7528<\/a> \/\/ \u5b87\u5b99\u4e4b\u4e00\u7c9f<\/strong><\/p><\/blockquote>\n<p>\u672c\u6587\u4ecb\u7ecd\u4e86\u5fae\u670d\u52a1\u53ca\u5176\u76f8\u5173\u6982\u5ff5\uff0c\u91cd\u70b9\u6bd4\u8f83\u4e86\u5355\u4f53\u67b6\u6784\u548c\u5fae\u670d\u52a1\u67b6\u6784\u7684\u533a\u522b\uff0c\u6700\u540e\u4ecb\u7ecd\u4e86 Go \u4f18\u79c0\u7684\u5fae\u670d\u52a1\u6846\u67b6\u4e4b\u4e00\u7684 Go-micro\uff0c\u5e76\u5c55\u793a\u8be5\u6846\u67b6\u7684\u5b89\u88c5\u548c\u4f7f\u7528\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042773134\">Go \u5fae\u670d\u52a1\u5b9e\u6218\u4e4b\u5982\u4f55\u5b9e\u73b0\u52a0\u89e3\u5bc6\u64cd\u4f5c\u7684\u5fae\u670d\u52a1\u5f00\u53d1<\/a> \/\/ \u5b87\u5b99\u4e4b\u4e00\u7c9f<\/strong><\/p><\/blockquote>\n<p>\u672c\u6587\u901a\u8fc7\u5b9e\u73b0\u52a0\u89e3\u5bc6\u64cd\u4f5c\u5c55\u793a\u4e86\u4e00\u4e2a\u5fae\u670d\u52a1\u5e94\u7528\u7684\u5f00\u53d1\u8fc7\u7a0b\u3002\u901a\u8fc7\u7f16\u5199\u670d\u52a1\u7aef\uff0c\u6210\u529f\u8fd0\u884c\u4e86\u4e00\u4e2a\u5fae\u670d\u52a1\u5b9e\u4f8b\uff0c\u8be5\u670d\u52a1\u80fd\u591f\u901a\u8fc7\u52a0\u5bc6\u8bf7\u6c42\u5f97\u5230\u4e00\u4e2a\u52a0\u5bc6\u540e\u7684\u5bc6\u6587\uff0c\u901a\u8fc7\u89e3\u5bc6\u8bf7\u6c42\u5c06\u6d88\u606f\u8fdb\u884c\u89e3\u5bc6\uff0c\u5e76\u8fd4\u56de\u660e\u6587\u7ed3\u679c\u3002\u7136\u540e\u901a\u8fc7\u7f16\u5199\u5ba2\u6237\u7aef\u5411\u670d\u52a1\u7aef\u8fdb\u884c RPC \u8c03\u7528\uff0c\u6210\u529f\u5c06 Hello world \u5b57\u7b26\u4e32\u8fdb\u884c\u52a0\u5bc6\u5e76\u6253\u5370\u51fa\u5bc6\u6587\u548c\u660e\u6587\u7684\u7ed3\u679c\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042808039\">\u56de\u58f0\u5639\u4eae \u4e4b Go \u7684 Echo \u6846\u67b6 \u2014\u2014 \u4e0a\u624b\u521d\u4f53\u9a8c<\/a> \/\/ \u5b87\u5b99\u4e4b\u4e00\u7c9f<\/strong><\/p><\/blockquote>\n<p>Go \u8bed\u8a00\u7684 Web \u5f00\u53d1\u6846\u67b6\u5176\u5b9e\u4e5f\u6709\u5f88\u591a\uff1a Gin \u3001 Beego \u3001 Revel \u3002<br \/>Echo \u4f5c\u4e3a\u5176\u4e2d\u7684\u4e00\u6b3e\u3002\u622a\u6b62\u5230 2022 \u5e74\uff0c\u76ee\u524d\u5df2\u7ecf\u5728 Github \u4e0a\u6536\u83b7\u4e86 21.7k \u7684 Star \u548c 1.9k \u7684 Fork\uff0c\u53ef\u4ee5\u8bf4\u662f\u7ecf\u5f97\u8d77\u65f6\u95f4\u68c0\u9a8c\uff0c\u5f97\u5230\u4e86\u5927\u5bb6\u7684\u8ba4\u53ef\uff0c\u6b63\u53ef\u8c13\u5bf9\u5e94\u4e0a\u6807\u9898\u4e2d\u7684\u56de\u58f0\u5639\u4eae\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042808076\">\u5982\u4f55\u5728 Go \u4ee3\u7801\u4e2d\u8fd0\u884c C \u8bed\u8a00\u4ee3\u7801<\/a> \/\/ \u5b87\u5b99\u4e4b\u4e00\u7c9f<\/strong><\/p><\/blockquote>\n<p>\u6211\u4eec\u4e86\u89e3\u5230\uff0cGo \u8bed\u8a00\u8131\u80ce\u4e8e C \u8bed\u8a00\uff0c\u8fd9\u5c31\u610f\u5473\u7740\u5728\u67d0\u4e9b\u66f4\u5e95\u5c42\u7684\u7ec6\u8282\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 C \u8bed\u8a00\u5b9e\u73b0\uff0c\u7136\u540e\u901a\u8fc7 Go \u6765\u8c03\u7528\u76f8\u5173\u7684 C \u4ee3\u7801\u3002\u5176\u5b9e\u8fd9\u4e00\u7279\u70b9\uff0c\u5728 Java \u7684 JVM\u3001Python \u7684\u89e3\u91ca\u5668\u4e5f\u662f\u901a\u8fc7\u5e95\u5c42\u662f\u76f4\u63a5\u8c03\u7528 C \u5b9e\u73b0\u7684\u3002<br \/>\u800c\u672c\u7bc7\u6587\u7ae0\u5c31\u6765\u5b66\u4e60\u4e00\u4e0b\uff0c\u5982\u4f55\u5728 Go \u8bed\u8a00\u4e2d\u8fd0\u884c C \u7a0b\u5e8f\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042811879\">Go \u8bed\u8a00\u5982\u4f55\u8fde\u63a5\u5e76\u64cd\u4f5c MySQL \u6570\u636e\u5e93<\/a> \/\/ \u5b87\u5b99\u4e4b\u4e00\u7c9f<\/strong><\/p><\/blockquote>\n<p>Go \u6709 sql \u5305\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u56f4\u7ed5 SQL\uff08\u6216\u7c7b\u4f3c SQL\uff09\u6570\u636e\u5e93\u7684\u901a\u7528\u63a5\u53e3\u3002 sql \u5305\u5fc5\u987b\u4e0e\u6570\u636e\u5e93\u9a71\u52a8\u7a0b\u5e8f\u4e00\u8d77\u4f7f\u7528\u3002\u8be5\u8f6f\u4ef6\u5305\u63d0\u4f9b\u81ea\u52a8\u8fde\u63a5\u6c60\u3002\u6bcf\u6b21\u67e5\u8be2\u6570\u636e\u5e93\u65f6\uff0c\u6211\u4eec\u90fd\u5728\u4f7f\u7528\u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u65f6\u8bbe\u7f6e\u7684\u8fde\u63a5\u6c60\u4e2d\u7684\u8fde\u63a5\uff0c\u8fde\u63a5\u88ab\u91cd\u7528\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042764923\">Go \u5341\u5e74\u4e86\uff0c\u7ec8\u4e8e\u60f3\u8d77\u8981\u7edf\u4e00 log \u5e93\u4e86\uff01<\/a> \/\/ \u714e\u9c7c <\/strong><\/p><\/blockquote>\n<p>\u601d\u8003\u4e00\u4e2a\u95ee\u9898\uff1a\u5e73\u65f6\u4f60\u5728\u5199 Go \u5de5\u7a0b\u65f6\uff0c\u662f\u5426\u5f88\u5c11\u76f4\u63a5\u4f7f\u7528\u5b98\u65b9\u6807\u51c6\u5e93 log\uff1f<br \/>\u5728\u6b63\u5f0f\u9879\u76ee\u4e2d\uff0c\u5927\u591a\u662f\u4f18\u5148\u4f7f\u7528\u51e0\u4e2a\u7206\u6b3e\u7b2c\u4e09\u65b9\u5e93\uff0c\u4f8b\u5982\uff1aLogrus\u3001Zap\u3001zerolog\u3002\u800c\u6807\u51c6\u5e93 log\uff0c\u5728\u4e34\u65f6\u8c03\u8bd5\uff0c\u5c4f\u5e55\u8f93\u51fa\u7684\u573a\u666f\u5c45\u591a\uff0c\u5360\u6bd4\u8f83\u5c11\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042851734\">\u5728 Golang \u4e2d\u4f9d\u8d56\u6ce8\u5165\u662f \u89e3\u836f \u8fd8\u662f \u6bd2\u836f\uff1f<\/a> \/\/ LinkinStar <\/strong><\/p><\/blockquote>\n<p>\u56de\u8fc7\u5934\u6765\u770b\u6211\u4e00\u5f00\u59cb\u8bf4\u7684\u89c2\u70b9\u5176\u5b9e\u5c31\u4e0d\u77db\u76fe\u4e86\uff0c\u5c31\u62ff\u6211\u81ea\u5df1\u4e3e\u4f8b\u6765\u8bf4\uff0c\u5982\u679c\u662f\u4e00\u4e9b\u5c0f\u9879\u76ee\uff0c\u5e76\u4e14\u5f88\u591a\u65f6\u5019 go \u5e76\u4e0d\u662f\u505a web \u5f00\u53d1\uff0c\u66f4\u591a\u7684\u662f\u505a\u5de5\u5177\u90a3\u4e48 DI \u6709\u65f6\u5019\u5e76\u4e0d\u4e00\u5b9a\u9700\u8981\u3002<br \/>\u4f46\u662f\u5bf9\u4e8e\u4e00\u4e9b\u5927\u9879\u76ee\u6765\u8bf4\uff0c\u6211\u89c9\u5f97\u4e3a\u4e86\u4ee5\u540e\u7684\u8003\u8651\uff0c\u8fd8\u662f\u522b\u6316\u5751\u4e86\uff0c\u65e0\u8bba\u662f\u4ece\u6d88\u9664\u5168\u5c40\u53d8\u91cf\u8fd8\u662f\u6269\u5c55\u6027\u6765\u8bf4\uff0cDI \u6216\u8005\u8bf4 OOP \u90fd\u662f\u975e\u5e38\u6709\u5fc5\u8981\u7684\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042882759\">Gin + GORM \u5165\u95e8\u5230\u5b9e\u6218<\/a> \/\/  \u7a0b\u5e8f\u5458\u6d77\u519b<\/strong><\/p><\/blockquote>\n<p>\u6700\u8fd1\u4e00\u76f4\u5728\u5b66\u4e60 Go\uff0c\u76ee\u524d\u5728\u505a\u9879\u76ee\u719f\u6089 Go \u9636\u6bb5\u3002 \u672c\u6587\u6765\u5206\u4eab\u4e00\u4e0b Gin + GORM \u7684\u4e00\u4e9b \u5f00\u53d1\u4f53\u9a8c\uff0c\u6709\u559c\u6b22 Go \u65b9\u5411\u7684\u670b\u53cb\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042838770\">Go\u5165\u95e8\u7cfb\u5217\uff1a\u4f60\u597d\uff0c\u4e16\u754c<\/a> \/\/  \u4f3c\u6c34\u6d41\u5e74 <\/strong><\/p><\/blockquote>\n<p>Go \u6e90\u7801\u9700\u8981\u5148\u7f16\u8bd1\uff0c\u518d\u5206\u53d1\u548c\u8fd0\u884c\u3002\u5982\u679c\u662f\u5355 Go \u6e90\u6587\u4ef6\u7684\u60c5\u51b5\uff0c\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 go build \u547d\u4ee4 +Go \u6e90\u6587\u4ef6\u540d\u7684\u65b9\u5f0f\u7f16\u8bd1\u3002\u4e0d\u8fc7\uff0c\u5bf9\u4e8e\u590d\u6742\u7684 Go \u9879\u76ee\uff0c\u6211\u4eec\u9700\u8981\u5728 Go Module \u7684\u5e2e\u52a9\u4e0b\u5b8c\u6210\u9879\u76ee\u7684\u6784\u5efa\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042756534\">go \u5982\u4f55\u4ece\u96f6\u7f16\u5199 protoBuf \u63d2\u4ef6<\/a> \/\/ \u6d77\u751f <\/strong><\/p><\/blockquote>\n<p>\u672c\u671f\u7684\u4e3b\u8981\u5185\u5bb9\u5c06\u624b\u628a\u624b\u6559\u4f1a\u5927\u5bb6\uff0c\u7f16\u5199 probuf \u7684 go \u63d2\u4ef6\uff0c\u4ee5\u6211\u81ea\u5df1\u7f16\u5199\u7684\u4e00\u4e2a\u751f\u6210\u7ed3\u6784\u4f53\u7684\u63d2\u4ef6\u4e3a\u4f8b\u5b50\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042775075\">go \u8bed\u8a00 web \u5f00\u53d1\u6846\u67b6 \u2014 gin \u6846\u67b6\u5165\u95e8<\/a> \/\/ \u826f\u733f <\/strong><\/p><\/blockquote>\n<p>\u5b89\u88c5\u5e76\u914d\u7f6e GO \u5de5\u4f5c\u533a\uff0c\u5728 GOPATH \u7684 src \u76ee\u5f55\u4e0b\u65b0\u5efa\u9879\u76ee\u6587\u4ef6\u5939\uff0c\u4f7f\u7528 go mod init\u547d\u4ee4\u521d\u59cb\u5316\u9879\u76ee\uff0c\u4f7f\u7528 go get -u github.com\/gin-gonic\/gin \u547d\u4ee4\u5b89\u88c5 gin\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042832082\">Go \u8bed\u8a00\u4e0e\u6570\u636e\u5e93 \u2014 GORM \u5165\u95e8<\/a> \/\/ \u826f\u733f <\/strong><\/p><\/blockquote>\n<pre><code>go get -u gorm.io\/gorm\ngo get -u gorm.io\/driver\/mysql<\/code><\/pre>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042798553\">Golang Copier \u5165\u95e8\u5230\u5165\u5751<\/a> \/\/ \u5c0f\u767d\u8981\u751f\u53d1 <\/strong><\/p><\/blockquote>\n<p>\u7531\u4e8e golang \u6ca1\u6709\u5bf9\u590d\u6742\u7ed3\u6784\u4f53\u7684 clone \u65b9\u6cd5\uff0c\u6240\u4ee5\uff0c\u5c31\u9700\u8981\u6709 copier \u8fd9\u6837\u7684\u5de5\u5177\u5e93\u3002<br \/>\u5b83\u770b\u8d77\u6765\u5f88\u7b80\u5355\uff0c\u4f46\u5b9e\u9645\u4f7f\u7528\u4e2d\uff0c\u6709\u4e9b\u201c\u5751\u201d\u8fd8\u662f\u8981\u6ce8\u610f\uff01<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042882459\">\u52a8\u56fe\u56fe\u89e3\uff01\u600e\u4e48\u8ba9 goroutine \u8dd1\u4e00\u534a\u5c31\u9000\u51fa\uff1f<\/a> \/\/ \u5c0f\u767ddebug<\/strong><\/p><\/blockquote>\n<p>\u901a\u8fc7 runtime.Goexit() \u53ef\u4ee5\u505a\u5230\u63d0\u524d\u7ed3\u675f\u534f\u7a0b\uff0c\u4e14\u7ed3\u675f\u524d\u8fd8\u80fd\u6267\u884c\u5230 defer \u7684\u5185\u5bb9<br \/>runtime.Goexit() \u5176\u5b9e\u662f\u5bf9 goexit0 \u7684\u5c01\u88c5\uff0c\u53ea\u8981\u6267\u884c goexit0 \u8fd9\u4e2a\u51fd\u6570\uff0c\u5f53\u524d\u534f\u7a0b\u5c31\u4f1a\u9000\u51fa\uff0c\u540c\u65f6\u8fd8\u80fd\u8c03\u5ea6\u4e0b\u4e00\u4e2a\u53ef\u6267\u884c\u7684\u534f\u7a0b\u51fa\u6765\u8dd1\u3002<br \/>\u901a\u8fc7 newproc \u53ef\u4ee5\u521b\u5efa\u51fa\u65b0\u7684 goroutine\uff0c\u5b83\u4f1a\u5728\u51fd\u6570\u6808\u5e95\u90e8\u63d2\u5165\u4e00\u4e2a goexit\u3002<br \/>os.Exit() \u6307\u7684\u662f\u6574\u4e2a\u8fdb\u7a0b\u9000\u51fa\uff1b\u800c runtime.Goexit() \u6307\u7684\u662f\u534f\u7a0b\u9000\u51fa\u3002\u4e24\u8005\u542b\u4e49\u6709\u533a\u522b\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042773542\">Go \u4e2d\u8c03\u7528\u5916\u90e8\u547d\u4ee4\u7684\u51e0\u79cd\u59ff\u52bf<\/a> \/\/ darjun<\/strong><\/p><\/blockquote>\n<p>\u672c\u6587\u4ecb\u7ecd\u4e86\u4f7f\u7528 os\/exec \u8fd9\u4e2a\u6807\u51c6\u5e93\u8c03\u7528\u5916\u90e8\u547d\u4ee4\u7684\u5404\u79cd\u59ff\u52bf\u3002\u540c\u65f6\u4e3a\u4e86\u4fbf\u4e8e\u4f7f\u7528\uff0c\u6211\u7f16\u5199\u4e86\u4e00\u4e2a goexec \u5305\u5c01\u88c5\u5bf9 os\/exec \u7684\u8c03\u7528\u3002\u8fd9\u4e2a\u5305\u76ee\u524d for \u6211\u81ea\u5df1\u4f7f\u7528\u662f\u6ca1\u6709\u95ee\u9898\u7684\uff0c\u5927\u5bb6\u6709\u5176\u4ed6\u9700\u6c42\u53ef\u4ee5\u63d0 issue \u6216\u8005\u81ea\u5df1\u9b54\u6539<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042788204\">\u5fae\u670d\u52a1\u6846\u67b6 go-zero \u5feb\u901f\u5b9e\u6218<\/a> \/\/ \u963f\u5175\u4e91\u539f\u751f<\/strong><\/p><\/blockquote>\n<p>go-zero \u662f\u4e00\u4e2a\u96c6\u6210\u4e86\u5404\u79cd\u5de5\u7a0b\u5b9e\u8df5\u7684 web \u548c rpc \u6846\u67b6\u3002\u901a\u8fc7\u5f39\u6027\u8bbe\u8ba1\u4fdd\u969c\u4e86\u5927\u5e76\u53d1\u670d\u52a1\u7aef\u7684\u7a33\u5b9a\u6027\uff0c\u7ecf\u53d7\u4e86\u5145\u5206\u7684\u5b9e\u6218\u68c0\u9a8c\u3002<br \/>go-zero \u4e2d\u7684 api\uff0crpc\uff0c\u6570\u636e\u5e93\u7b49\u6d89\u53ca\u7684\u4ee3\u7801\uff0c\u90fd\u53ef\u4ee5\u7ed9\u6211\u4eec\u4e00\u952e\u751f\u6210\uff0c\u65e0\u9700\u8017\u8d39\u6211\u4eec\u4ec0\u4e48\u7cbe\u529b<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042674041\">\u30105-5 Golang\u3011\u5b9e\u6218\u2014Go\u5fae\u670d\u52a1\u53d1\u73b0\u95ee\u9898\u5206\u6790<\/a> \/\/ \u897f\u7ea2\u67ff<\/strong><\/p><\/blockquote>\n<p>\u521d\u6b21\u9047\u5230\u8fd9\u95ee\u9898\u65f6\u5019\uff0c\u89c9\u5f97\u532a\u5937\u6240\u601d\u3002\u57fa\u4e8e\u73b0\u72b6\uff0c\u51b7\u9759\u5206\u6790\u95ee\u9898\u4ea7\u751f\u60c5\u51b5\uff0c\u4e00\u4e2a\u4e00\u4e2a\u53bb\u6392\u67e5\u6216\u8005\u6392\u9664\uff0c\u5207\u8bb0\u6025\u8e81\u3002<br \/>\u6293\u5305\u9a8c\u8bc1\uff0c\u4e8c\u8fdb\u5236\u534f\u8bae\u53c8\u4e0d\u65b9\u4fbf\u5206\u6790\uff0c\u53ea\u80fd\u53bb\u7814\u7a76zookeeper\u901a\u4fe1\u534f\u8bae\u4e86\u3002\u6700\u7ec8\u8fd8\u662f\u9700\u8981\u4e00\u904d\u4e00\u904dReview\u4ee3\u7801\uff0c\u5bfb\u627e\u86db\u4e1d\u9a6c\u8ff9\uff0c\u4e0d\u8981\u5ffd\u89c6\u4efb\u4f55\u53ef\u80fd\u4ea7\u751f\u7684\u5f02\u5e38\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042764959\">Go \uff0c\u6d45\u8c08\u5305\u7ba1\u7406\u6a21\u5f0f<\/a> \/\/ \u751c\u70b9cc<\/strong><\/p><\/blockquote>\n<p>\u4efb\u4f55\u4e00\u95e8\u7f16\u7a0b\u8bed\u8a00\u90fd\u79bb\u4e0d\u5f00\u5bf9\u5404\u79cd\u5de5\u5177\u5305\u7684\u4f7f\u7528\uff0c\u5de5\u5177\u5305\u7684\u7ba1\u7406\u5c31\u663e\u5f97\u5f02\u5e38\u91cd\u8981\u4e86\u3002Go \u7684\u5305\u7ba1\u7406\u65b9\u5f0f\u662f\u9010\u6e10\u6f14\u8fdb\u7684\uff0c\u672c\u6587\u4ecb\u7ecd Go \u8bed\u8a00\u7684\u4e24\u79cd\u5305\u7ba1\u7406\u6a21\u5f0f\u3002<\/p>\n<blockquote><p><strong><a href=\"https:\/\/segmentfault.com\/a\/1190000042756457\">Go \uff0c\u51fd\u6570\uff08\u5305\uff09\u7684\u4f7f\u7528<\/a> \/\/ \u751c\u70b9cc<\/strong><\/p><\/blockquote>\n<p>\u672c\u6587\u901a\u8fc7\u4e00\u4e2a\u5b9e\u73b0\u52a0\u51cf\u4e58\u9664\u8fd0\u7b97\u7684\u5c0f\u7a0b\u5e8f\u6765\u4ecb\u7ecd go \u51fd\u6570\u7684\u4f7f\u7528\uff0c\u4ee5\u53ca\u4f7f\u7528\u51fd\u6570\u7684\u6ce8\u610f\u4e8b\u9879\uff0c\u5e76\u5f15\u51fa\u4e86\u5bf9\u5305\u7684\u4e86\u89e3\u548c\u4f7f\u7528\u3002<\/p>\n<hr>\n<blockquote>\n<p><strong># SegmentFault \u6280\u672f\u5468\u520a #<\/strong><\/p>\n<p>\u300c\u6280\u672f\u5468\u520a\u300d\u662f\u793e\u533a\u7279\u522b\u63a8\u51fa\u7684\u6280\u672f\u5185\u5bb9\u7cfb\u5217\uff0c\u4e00\u5468\u4e00\u4e3b\u9898\u3002<\/p>\n<p>\u6bcf\u5468\u4e8c\u66f4\u65b0\uff0c\u6b22\u8fce\u300c<a href=\"https:\/\/segmentfault.com\/blog\/weekly\">\u5173\u6ce8<\/a>\u300d\u3002\u5927\u5bb6\u4e5f\u53ef\u4ee5\u5728\u8bc4\u8bba\u5904\u7559\u8a00\u81ea\u5df1\u611f\u5174\u8da3\u7684\u4e3b\u9898\uff0c\u63a8\u8350\u4e3b\u9898\u76f8\u5173\u7684\u4f18\u79c0\u6587\u7ae0\u3002<\/p>\n<p>\u5982\u6709\u95ee\u9898\u53ef\u4ee5\u6dfb\u52a0\u5c0f\u59d0\u59d0\u5fae\u4fe1~<\/p>\n<\/blockquote>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcRHWM\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000042920349\">https:\/\/segmentfault.com\/a\/1190000042920349<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u521a\u521a\u7ed3\u675f\u7684\u5173\u4e8e\u300cGo\u300d\u8bed\u8a00\u7684\u6280\u672f\u5f81\u6587\u6d3b\u52a8\uff0c\u53c2\u4e0e\u6d3b\u52a8\u7684\u521b\u4f5c\u8005\u4eec\uff0c\u64b0\u5199\u4e86\u5f88\u591a\u4f18\u8d28\u6280\u672f\u5185\u5bb9\uff0c\u672c\u671f\u5468\u520a\u505a\u4e86\u6c47\u603b\uff0c\u6b22\u8fce\u5927 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10006934","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006934","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10006934"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006934\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10006934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10006934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10006934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}