{"id":13966,"date":"2023-07-22T07:52:32","date_gmt":"2023-07-21T23:52:32","guid":{"rendered":"https:\/\/aif.amtbbs.org\/?p=13966"},"modified":"2023-07-22T07:52:32","modified_gmt":"2023-07-21T23:52:32","slug":"go-%e8%af%ad%e8%a8%80%e7%9a%84%e4%bc%98%e7%82%b9%e3%80%81%e7%bc%ba%e7%82%b9%e5%92%8c%e5%b9%b3%e6%b7%a1%e6%97%a0%e5%a5%87%e4%b9%8b%e5%a4%84%e7%9a%84%e5%8d%81%e5%b9%b4","status":"publish","type":"post","link":"https:\/\/aif.amtbbs.org\/index.php\/2023\/07\/22\/13966\/","title":{"rendered":"\u201cGo \u8bed\u8a00\u7684\u4f18\u70b9\u3001\u7f3a\u70b9\u548c\u5e73\u6de1\u65e0\u5947\u4e4b\u5904\u201d\u7684\u5341\u5e74"},"content":{"rendered":"<p>\u5341\u5e74\u524d\uff0c\u6211\u64b0\u5199\u4e86\u4e00\u7bc7\u540d\u4e3aGo \u8bed\u8a00\uff1a\u4f18\u70b9\u3001\u7f3a\u70b9\u548c\u5e73\u6de1\u65e0\u5947\u4e4b\u5904\u3002\u8be5\u7bc7\u6587\u7ae0\u5728 2013 \u5e74\u51b2\u4e0a\u4e86Hacker News \u7684\u9996\u9875\uff0c\u5e76\u5728\/r\/programming \u4e0a \u6536\u83b7\u4e86\u8d85\u8fc7 400 \u6761\u8bc4\u8bba\u3002\u5c3d\u7ba1\u6211\u672a\u7559\u4e0b\u5f53\u65f6\u7684\u5206\u6790\u6570\u636e\uff0c\u4f46\u6211\u63a8\u6d4b\u8fd9\u5e94\u8be5\u662f\u6211\u6700\u53d7\u5173\u6ce8\u7684\u6587\u7ae0\u4e4b\u4e00\uff0c\u800c\u4e14\u8fd9\u7edd\u5bf9\u662f\u6211\u7b2c\u4e00\u6b21\u5728\u5199\u4f5c\u4e2d\u6536\u83b7\u5927\u91cf\u53cd\u9988\u7684\u96be\u5fd8\u7ecf\u5386\u3002<\/p>\n<p>\u5982\u4eca\uff0c\u5341\u5e74\u8fc7\u53bb\u4e86\u3002\u5728\u8fd9\u6bb5\u65f6\u95f4\u91cc\uff0c\u6211\u4ece\u4e00\u4e2a\u51fa\u4e8e\u5a31\u4e50\u5fc3\u6001\u53ea\u662f\u8bd5\u9a8c Go \u8bed\u8a00\u7684\u4e1a\u4f59\u7231\u597d\u8005\uff0c\u8f6c\u53d8\u4e3a\u4e00\u540d\u5c06 Go \u5217\u4e3a\u4e3b\u8981\u7f16\u7a0b\u8bed\u8a00\u7684\u4e13\u4e1a\u7a0b\u5e8f\u5458\u3002\u56e0\u6b64\uff0c\u6211\u89c9\u5f97\u73b0\u5728\u56de\u987e\u5e76\u5206\u6790\u6211\u5f53\u5e74\u7684\u89c2\u70b9\uff0c\u63a2\u8ba8\u6211\u51c6\u786e\u9884\u6d4b\u4e86\u4ec0\u4e48\u3001\u4ec0\u4e48\u4e8b\u60c5\u53d1\u751f\u4e86\u6539\u53d8\uff0c\u4ee5\u53ca\u6211\u5ffd\u89c6\u548c\u72af\u4e0b\u4e86\u54ea\u4e9b\u9519\u8bef\uff0c\u8fd9\u4f1a\u662f\u4e00\u6b21\u6709\u8da3\u7684\u7ecf\u5386\u3002\u4f60\u53ef\u4ee5\u9605\u8bfb\u6216\u91cd\u65b0\u9605\u8bfb\u539f\u59cb\u535a\u6587\uff0c\u6216\u8005\u53ea\u9700\u5728\u8fd9\u91cc\u9605\u8bfb\u6211\u5bf9\u8fc7\u53bb\u7684\u56de\u987e\uff0c\u65e0\u9700\u6df1\u5165\u89e3\u6790\u90a3\u7bc7\u6587\u7ae0\u3002\u4f60\u53ea\u9700\u8981\u77e5\u9053\uff0c\u6b63\u5982\u5b83\u7684\u6807\u9898\u6240\u793a\uff0c\u6211\u5f53\u65f6\u628a\u6211\u5bf9 Go \u8bed\u8a00\u7684\u8bc4\u4ef7\u5206\u4e3a\u201c\u4f18\u70b9\u201d\u3001\u201c\u7f3a\u70b9\u201d\u548c\u201c\u5e73\u6de1\u65e0\u5947\u4e4b\u5904\u201d\u3002<\/p>\n<p>\u5bf9\u4e8e\u4efb\u4f55\u5e0c\u671b\u5c06\u672c\u6587\u63d0\u4ea4\u81f3\u793e\u4ea4\u5a92\u4f53\u7684\u8bfb\u8005\uff0c\u8bf7\u6ce8\u610f\uff0c\u6807\u9898\u4e2d\u7684\u5f15\u53f7\u975e\u5e38\u91cd\u8981\u3002\u5207\u52ff\u5220\u9664\u5b83\u4eec\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13967\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2023\/07\/4ffce04d92a4d6cb21c1494cdfcd6dc1-31.png\" width=\"120\" height=\"96\" alt=\"\u56fe\u7247\" \/><\/p>\n<h2><strong>\u6211\u7684\u51c6\u786e\u9884\u6d4b<\/strong><\/h2>\n<p>\u6211\u4ecd\u7136\u8ba4\u540c\u6211\u5728&#8221;\u4f18\u70b9&#8221;\u90e8\u5206\u5217\u51fa\u7684\u5927\u90e8\u5206\u5185\u5bb9\u3002\u4ee5\u4e0b\u6240\u6709\u89c2\u70b9\u6211\u90fd\u4f9d\u7136\u8ba4\u4e3a\u662f\u5bf9\u7684\uff1a<\/p>\n<ul class=\"list-paddingleft-1\">\n<li>Go \u8bed\u8a00\u662f\u4e3a\u4e86\u5728\u62e5\u6709\u73b0\u4ee3\u7248\u63a7\u7cfb\u7edf\u7684\u56e2\u961f\u4e2d\u5f00\u53d1\u5927\u578b\u9879\u76ee\u800c\u8bbe\u8ba1\u7684<\/li>\n<li>\u901a\u8fc7\u5927\u5199\u5b57\u6bcd\u6765\u533a\u5206\u51fd\u6570\u3001\u65b9\u6cd5\u3001\u53d8\u91cf\u548c\u5b57\u6bb5\u7684\u516c\u6709\/\u79c1\u6709\u72b6\u6001<\/li>\n<li>\u5c06\u76ee\u5f55\u4f5c\u4e3a\u5305\u7ba1\u7406\u7684\u57fa\u672c\u5355\u5143<\/li>\n<li>\u4f7f\u7528\u5355\u4e00\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u8fdb\u884c\u90e8\u7f72<\/li>\n<li>go \u5de5\u5177\u8fd0\u884c\u901f\u5ea6\u5feb\uff0c\u5185\u7f6e\u4e86 go fmt\u3001go doc \u548c go test<\/li>\n<li>\u4f7f\u7528\u540e\u7f6e\u7c7b\u578b\u6837\u5f0f\uff08var x int\uff09\u800c\u975e\u524d\u7f6e\u7c7b\u578b\u6837\u5f0f\uff08int x\uff09<\/li>\n<li>\u6709\u660e\u786e\u7684\u53d8\u91cf\u58f0\u660e\uff08\u76f8\u5bf9\u4e8e Python \u7684 = \u8fdb\u884c\u9690\u5f0f\u58f0\u660e\uff09<\/li>\n<li>Go Playground<\/li>\n<li>\u903b\u8f91\u7c7b\u578b\u540d\u79f0\uff08\u5982 int64\uff0cfloat32 \u7b49\uff0c\u800c\u975e long \u548c double\uff09<\/li>\n<li>\u63d0\u4f9b\u4e09\u79cd\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff1a\u5b57\u7b26\u4e32\u3001\u53d8\u957f\u6570\u7ec4\u548c\u54c8\u5e0c\u6620\u5c04<\/li>\n<li>\u63a5\u53e3\u7528\u4e8e\u7f16\u8bd1\u65f6\u7684\u9e2d\u5b50\u7c7b\u578b &#8211; \u00a0\u4e0d\u652f\u6301\u7ee7\u627f<\/li>\n<\/ul>\n<p>\u81f3\u4e8e\u5176\u4ed6\u90e8\u5206\uff0c\u6211\u4eec\u5c06\u5728\u540e\u7eed\u8fdb\u884c\u8ba8\u8bba\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13967\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2023\/07\/4ffce04d92a4d6cb21c1494cdfcd6dc1-31.png\" width=\"120\" height=\"96\" alt=\"\u56fe\u7247\" \/><\/p>\n<h2><strong>\u53d1\u751f\u7684\u53d8\u5316<\/strong><\/h2>\n<p>\u8fc7\u53bb\u5341\u5e74\u4e2d\uff0cGo \u8bed\u8a00\u7684\u6700\u663e\u8457\u53d8\u5316\u65e0\u7591\u662f\u5f15\u5165\u4e86\u6cdb\u578b\u3002<\/p>\n<p>\u5728\u6211\u4e4b\u524d\u7684\u6587\u7ae0\u4e2d\uff0c\u6211\u628a\u7f3a\u4e4f\u6cdb\u578b\u5217\u4e3a\u4e86 Go \u8bed\u8a00\u7684\u4e00\u5927\u5f0a\u7aef\uff1a<\/p>\n<blockquote><p>\u5728 Go \u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u5e38\u4f1a\u4f7f\u7528\u4e00\u4e9b\u7279\u6b8a\u7684\u6280\u5de7\uff0c\u901a\u8fc7\u63a5\u53e3\u6765\u907f\u514d\u4f7f\u7528\u6cdb\u578b\u3002\u4f46\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f60\u53ef\u80fd\u522b\u65e0\u9009\u62e9\uff0c\u53ea\u80fd\u5c06\u51fd\u6570\u590d\u5236\u7c98\u8d34\u591a\u6b21\uff0c\u4ee5\u9488\u5bf9\u4e0d\u540c\u7c7b\u578b\u8fdb\u884c\u64cd\u4f5c\u3002\u5982\u679c\u4f60\u9700\u8981\u6784\u5efa\u81ea\u5df1\u7684\u6570\u636e\u7ed3\u6784\uff0c\u4f60\u53ef\u80fd\u4f1a\u9009\u62e9 interface {} \u4f5c\u4e3a\u901a\u7528\u7c7b\u578b\uff0c\u4f46\u8fd9\u4f1a\u4e27\u5931\u7f16\u8bd1\u65f6\u7684\u7c7b\u578b\u5b89\u5168\u6027\u3002\u53cd\u4e4b\uff0c\u5982\u679c\u4f60\u60f3\u5b9e\u73b0\u4e00\u4e2a\u901a\u7528\u7684 sum \u51fd\u6570\uff0c\u5c31\u6ca1\u6709\u7406\u60f3\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/p><\/blockquote>\n<p>\u5728 2022 \u5e74 2 \u6708\u53d1\u5e03\u7684 \u00a0Go 1.18 \u7248\u672c\u4e2d\uff0c\u5f15\u5165\u4e86\u6cdb\u578b\u7279\u6027\u3002\u8fd9\u57fa\u672c\u4e0a\u89e3\u51b3\u4e86\u6211\u4ee5\u524d\u7684\u9047\u5230\u95ee\u9898\u3002\u4f8b\u5982\uff0c\u4e00\u4e2a\u6cdb\u578b\u7684 sum \u51fd\u6570\u4f1a\u50cf\u4e0b\u9762\u8fd9\u6837\uff1a<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"go\"><code><span class=\"code-snippet_outer\">type Numeric interface {<\/span><\/code><code><span class=\"code-snippet_outer\">  ~int | ~int8 | ~int16 | ~int32 | ~int64 |<\/span><\/code><code><span class=\"code-snippet_outer\">      ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr |<\/span><\/code><code><span class=\"code-snippet_outer\">      ~float64 | ~float32<\/span><\/code><code><span class=\"code-snippet_outer\">}<\/span><\/code><code><span class=\"code-snippet_outer\">\r\n<\/span><\/code><code><span class=\"code-snippet_outer\">func sum[N Numeric](vals ...N) N {<\/span><\/code><code><span class=\"code-snippet_outer\">  var total N = 0<\/span><\/code><code><span class=\"code-snippet_outer\">  for _, val := range vals {<\/span><\/code><code><span class=\"code-snippet_outer\">      total += val<\/span><\/code><code><span class=\"code-snippet_outer\">  }<\/span><\/code><code><span class=\"code-snippet_outer\">  return total<\/span><\/code><code><span class=\"code-snippet_outer\">}<\/span><\/code><\/pre>\n<\/section>\n<p>\u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u6cdb\u578b\u7684\u5f15\u5165\u65e0\u7591\u662f\u4e00\u9879\u91cd\u5927\u7684\u6539\u8fdb\u3002<\/p>\n<p>\u4e0e 2013 \u5e74\u7684 Go \u8bed\u8a00\u76f8\u6bd4\uff0c\u53e6\u4e00\u9879\u91cd\u8981\u53d8\u5316\u662f\u5f15\u5165\u4e86 Go modules\u3002\u6211\u5728\u8fc7\u53bb\u7684\u6587\u7ae0\u4e2d\u63d0\u5230\uff0c\u5f53\u65f6\u7684 \u00a0GOPATH \u7cfb\u7edf\u662f Go \u8bed\u8a00\u7684\u4e00\u5927\u4f18\u70b9\uff1a<\/p>\n<blockquote><p>\u5982\u679c\u4f60\u8fd0\u884c\u00a0go get github.com\/userA\/project\/\u00a0\uff0c\u5b83\u5c06\u4f7f\u7528 git \u4ece github.com \u4e0b\u8f7d\u9879\u76ee\uff0c\u5e76\u81ea\u52a8\u5c06\u5176\u653e\u7f6e\u5230\u6b63\u786e\u7684\u4f4d\u7f6e\u3002\u5982\u679c\u8be5\u9879\u76ee\u4e2d\u5305\u542b\u884cimport &#8220;bitbucket.com\/userB\/library&#8221;\u00a0\uff0cgo \u5de5\u5177\u4e5f\u80fd\u591f\u4e0b\u8f7d\u5e76\u5b89\u88c5\u8fd9\u4e2a\u5e93\u5230\u6307\u5b9a\u4f4d\u7f6e\u3002\u56e0\u6b64\uff0cGo \u8bed\u8a00\u4e00\u4e3e\u5177\u5907\u4e86\u81ea\u8eab\u7684\u4f18\u96c5\u6253\u5305\u89e3\u51b3\u65b9\u6848\u548c\u4e00\u4e2a\u73b0\u4ee3\u5316\u7684\u3001\u53bb\u4e2d\u5fc3\u5316\u7684 CPAN \u6216 PyPI \uff1a\u4f60\u5df2\u7ecf\u5728\u4f7f\u7528\u7684\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff01<\/p><\/blockquote>\n<p>Go modules \u5728\u539f\u6709\u7684\u7cfb\u7edf\u57fa\u7840\u4e0a\uff0c\u589e\u52a0\u4e86\u6307\u5b9a\u5bfc\u5165\u5305\u4ee5\u53ca Go \u672c\u8eab\u7684\u7248\u672c\u9700\u6c42\u7684\u529f\u80fd\u3002\u867d\u7136\u5728\u4ece GOPATH \u00a0\u5207\u6362\u5230 Go modules \u7684\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u4e86\u4e00\u4e9b\u6ce2\u6298\u548c\u4e0d\u6ee1\uff0c\u4f46\u603b\u7684\u6765\u8bf4\uff0c\u8fc7\u6e21\u975e\u5e38\u987a\u5229\uff0c\u5c31\u6211\u4e2a\u4eba\u800c\u8a00\uff0c\u6211\u5e76\u672a\u9047\u5230\u592a\u591a\u5b9e\u9645\u95ee\u9898\u3002\u5b83\u7684\u5de5\u4f5c\u65b9\u5f0f\u5f88\u6709\u6548\uff0c\u5927\u591a\u6570\u65f6\u5019\u4f60\u65e0\u9700\u8fc7\u591a\u8003\u8651\u5b83\u3002<\/p>\n<p>\u5728\u6211\u4e4b\u524d\u7684\u6587\u7ae0\u4e2d\uff0c\u6211\u63d0\u5230\u5bf9\u4e8e Go \u7f16\u8bd1\u5668\u53ea\u4ea7\u751f\u9519\u8bef\u800c\u4e0d\u4ea7\u751f\u8b66\u544a\u7684\u60c5\u51b5\u6211\u5e76\u672a\u6709\u592a\u5927\u7684\u611f\u89e6\u3002\u4f46\u8fc7\u53bb\u5341\u5e74\u4e2d\uff0c\u8fd9\u4e2a\u95ee\u9898\u5df2\u7ecf\u6f14\u53d8\u4e3a go vet \u00a0\u53ef\u4ee5\u4ea7\u751f\u4f4e\u8bef\u62a5\u7387\u7684\u9519\u8bef\uff0c\u800c\u5176\u4ed6\u8b66\u544a\u5219\u53ef\u4ee5\u901a\u8fc7\u5404\u79cd lint \u5de5\u5177\u4ea7\u751f\u3002\u6240\u4ee5\uff0c\u4ece\u6280\u672f\u89d2\u5ea6\u6765\u8bf4\uff0c\u7f16\u8bd1\u5668\u4f9d\u7136\u6ca1\u6709\u8b66\u544a\uff0c\u4f46\u5728\u5b9e\u9645\u4f7f\u7528\u4e2d\uff0cGo \u7684\u751f\u6001\u7cfb\u7edf\u786e\u5b9e\u63d0\u4f9b\u4e86\u5f88\u591a\u4ea7\u751f\u8b66\u544a\u7684\u9014\u5f84\u3002\u8fd9\u53ea\u662f\u5728\u4f60\u60f3\u8981\u6279\u8bc4 Go \u65f6\uff0c\u624d\u4f1a\u6210\u4e3a\u4e00\u4e2a\u6709\u8da3\u7684\u5dee\u5f02\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13969\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2023\/07\/4ffce04d92a4d6cb21c1494cdfcd6dc1-33.png\" width=\"120\" height=\"96\" alt=\"\u56fe\u7247\" \/><\/p>\n<h2><strong>\u6211\u7684\u758f\u6f0f\u4e4b\u5904<\/strong><\/h2>\n<p>\u5728\u56de\u987e\u6211\u5148\u524d\u7684\u6587\u7ae0\u65f6\uff0c\u6211\u6ce8\u610f\u5230\u5e76\u672a\u6d89\u53ca\u8054\u5408\u7c7b\u578b\u3001\u4ea4\u53c9\u7c7b\u578b\u6216\u8005\u53ef\u9009\u503c\u8fd9\u4e9b\u6982\u5ff5\u3002\u8fd9\u53cd\u6620\u51fa\u5728\u8fc7\u53bb\u7684\u5341\u5e74\u4e2d\uff0c\u6574\u4e2a\u884c\u4e1a\u7684\u72b6\u51b5\u53d8\u5316\u5267\u70c8\u3002\u5728\u5f53\u65f6\uff0c\u548c\u7c7b\u578b\u53ca\u53ef\u9009\u503c\u4ecd\u88ab\u89c6\u4e3a\u5b66\u672f\u6027\u7684\u7279\u6027\uff0c\u9664\u4e86 Haskell \u8fd9\u6837\u7684 ML \u884d\u751f\u8bed\u8a00\uff0c\u4e3b\u6d41\u7684 C \u5f71\u54cd\u8bed\u8a00\u5e76\u6ca1\u6709\u6db5\u76d6\u8fd9\u4e9b\u7279\u6027\u3002\u7136\u800c\uff0c\u81ea\u4ece 2014 \u5e74 Swift \u548c 2015 \u5e74 Rust \u7684\u8bde\u751f\u4ee5\u6765\uff0c \u6240\u6709\u7684\u8bed\u8a00\u90fd\u5f00\u59cb\u6839\u636e\u5176\u662f\u5426\u89e3\u51b3\u4e86&#8221;\u7a7a\u6307\u9488\u9519\u8bef&#8221;\uff08\u88ab\u6bd4\u55bb\u4e3a\u5341\u4ebf\u7f8e\u5143\u7684\u9519\u8bef\uff09\u8fdb\u884c\u8bc4\u4ef7\u3002<\/p>\n<p>\u53ef\u60dc\u7684\u662f\uff0cGo\u8bed\u8a00\u5df2\u7ecf\u6709\u592a\u591a\u4f7f\u7528\u00a0nil\u00a0\u00a0\u503c\u7684\u4ee3\u7801\uff0c\u6240\u4ee5\u5f88\u96be\u53bb\u6389\u00a0nil\u00a0\u503c\uff0c\u4ee5\u81f3\u4e8e\u6211\u4eec\u65e0\u6cd5\u771f\u6b63\u8f6c\u5411\u53ef\u9009\u7c7b\u578b\uff0c\u81f3\u5c11\u5728\u6211\u4eec\u6240\u4e86\u89e3\u7684 Go \u8bed\u8a00\u4e2d\u662f\u5982\u6b64\u3002\u7136\u800c\uff0c\u6709\u4e00\u4e2a\u901a\u8fc7\u9650\u5236\u63a5\u53e3\u503c\u6765\u6dfb\u52a0\u6c42\u548c\u7c7b\u578b \u7684\u63d0\u6cd5\uff0c\u6211\u8ba4\u4e3a\u8fd9\u6709\u5f88\u5927\u7684\u53ef\u80fd\u4ee5\u67d0\u79cd\u5f62\u5f0f\u5b9e\u73b0\u3002<\/p>\n<p>\u503c\u5f97\u4e00\u63d0\u7684\u662f\uff0c\u5bf9\u8bed\u8a00\u7684\u8bc4\u4ef7\u5df2\u7ecf\u53d1\u751f\u4e86\u53d8\u5316\u3002\u6211\u66fe\u7ecf\u8d5e\u8d4f Go \u7684\u7c7b\u578b\u63a8\u65ad\u4e3a\u6280\u672f\u8fdb\u6b65\uff0c\u800c\u73b0\u5728 Hacker News \u7684\u7528\u6237\u5219\u8ba4\u4e3a Go \u7684\u7c7b\u578b\u63a8\u65ad\u4e0e\u5176\u4ed6\u8bed\u8a00\u76f8\u6bd4\u8fd8\u6bd4\u8f83\u5f31\u3002\u9009\u62e9\u4e00\u4e2a\u4e0d\u4e3a\u4eba\u77e5\u7684\u8bed\u8a00\uff0c\u6216\u8005\u575a\u6301\u8db3\u591f\u4e45\uff0c\u603b\u4f1a\u6709\u4e00\u5929\u4f60\u4f1a\u6210\u4e3a\u522b\u4eba\u8bdf\u75c5\u7684\u76ee\u6807\u3002<\/p>\n<p>\u518d\u56de\u9996\u8fc7\u53bb\uff0c\u6211\u53d1\u73b0\u6211\u539f\u6587\u4e2d\u8fd8\u6709\u4e00\u4e2a\u758f\u6f0f\u662f\u6ca1\u6709\u63d0\u5230 Go 1 \u4fdd\u8bc1\u3002Go 1.0 \u53d1\u5e03\u65f6\uff0cGo \u56e2\u961f\u5bf9\u6e90\u4ee3\u7801\u7684\u517c\u5bb9\u6027\u505a\u51fa\u4e86\u627f\u8bfa\u3002\u5c3d\u7ba1\u4e00\u76f4\u90fd\u6709\u8b66\u544a\u3001\u9519\u8bef\u548c\u4f8b\u5916\u5b58\u5728\uff0c\u4f46\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\uff0c\u4ed6\u4eec\u6781\u5927\u5730\u9075\u5b88\u4e86\u8fd9\u4e2a\u627f\u8bfa\u3002\u516c\u6b63\u5730\u8bf4\uff0c\u5f53\u65f6\uff0cGo 1.0.3 \u662f\u6700\u65b0\u7684\u7248\u672c\uff0c\u56e0\u6b64\u6211\u65e0\u6cd5\u9884\u89c1 Go 1 \u7684\u627f\u8bfa\u5c06\u4f1a\u6301\u7eed\u5341\u5e74\u4ee5\u4e0a\uff0c\u4f46\u6211\u76f8\u4fe1\u8fd9\u5bf9 Go \u6210\u4e3a\u4eca\u5929\u7684\u8bed\u8a00\u53d1\u6325\u4e86\u5173\u952e\u4f5c\u7528\u3002\u5728 Go 1.0 \u4e4b\u524d\uff0cGo \u56e2\u961f\u7ecf\u5e38\u5bf9\u8bed\u8a00\u6216\u6807\u51c6\u5e93\u505a\u51fa\u6539\u53d8\uff0c\u4e3a\u4e86\u8ddf\u4e0a\u65b0\u6807\u51c6\uff0c\u9700\u8981\u5728\u4ee3\u7801\u5e93\u4e0a\u8fd0\u884c go fix\u3002\u7136\u800c\uff0c\u81ea\u90a3\u65f6\u4ee5\u6765\uff0c\u53ea\u8981\u4f60\u5199\u7684\u662f Go \u7a0b\u5e8f\uff0c\u4f7f\u7528\u7684\u662f\u6807\u51c6\u5e93\uff0c\u5e76\u4e14\u6ca1\u6709\u4f9d\u8d56\u4e8e\u4e0d\u5b89\u5168\u7684\u7279\u6027\u6216\u8005\u5b89\u5168\u6f0f\u6d1e\uff0c\u4f60\u5c31\u80fd\u4fdd\u8bc1\u4f60\u7684\u4ee3\u7801\u4e00\u76f4\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<p>\u76f8\u6bd4\u5176\u4ed6\u751f\u6001\u7cfb\u7edf\uff0c\u8fd9\u662f\u4e00\u80a1\u771f\u6b63\u7684\u6e05\u65b0\u4e4b\u98ce\uff0c\u4f5c\u4e3a\u5f00\u53d1\u4eba\u5458\uff0c\u8fd9\u662f\u6211\u6700\u559c\u6b22\u7684\u4e8b\u60c5\u4e4b\u4e00\u3002\u5728\u5176\u4ed6\u7f16\u7a0b\u8bed\u8a00\u4e2d\uff0c\u5347\u7ea7\u5230\u4e00\u4e2a\u65b0\u7248\u672c\uff08\u5373\u4f7f\u662f\u4e00\u4e2a\u6b21\u8981\u7248\u672c\uff09\uff0c\u5f80\u5f80\u8ba9\u4eba\u611f\u5230\u62c5\u5fe7\uff0c\u62c5\u5fc3\u4f1a\u6709\u4e00\u4e9b\u610f\u60f3\u4e0d\u5230\u7684\u95ee\u9898\u51fa\u73b0\u3002\u5373\u4f7f\u5728\u5347\u7ea7\u8fc7\u7a0b\u4e2d\u63d0\u524d\u901a\u8fc7\u5f03\u7528\u8b66\u544a\u58f0\u660e\u4e86\u95ee\u9898\uff0c\u4ecd\u7136\u9700\u8981\u82b1\u65f6\u95f4\u6765\u4fee\u590d\u76f8\u5173\u95ee\u9898\u3002\u4f46\u662f\u4f7f\u7528Go\uff0c\u6211\u4e0d\u4f1a\u62c5\u5fc3\u8fd9\u4e9b\u3002GO \u8bed\u8a00\u56e2\u961f\u975e\u5e38\u4e3a\u5f00\u53d1\u8005\u7740\u60f3\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13970\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2023\/07\/4ffce04d92a4d6cb21c1494cdfcd6dc1-34.png\" width=\"120\" height=\"96\" alt=\"\u56fe\u7247\" \/><\/p>\n<h2><strong>\u6211\u7684\u89c2\u70b9\u66f4\u65b0<\/strong><\/h2>\n<p>\u603b\u4f53\u800c\u8a00\uff0c\u6211\u8ba4\u4e3a\u6211\u4e4b\u524d\u7684\u535a\u6587\u8d28\u91cf\u4e0d\u9519\uff0c\u6ca1\u6709\u4ec0\u4e48\u660e\u663e\u7684\u9519\u8bef\u3002\u4e0d\u8fc7\uff0c\u867d\u7136\u5e76\u4e0d\u5b8c\u5168\u5426\u5b9a\u6211\u4e4b\u524d\u7684\u6709\u4e9b\u770b\u6cd5\uff0c\u4f46\u6211\u73b0\u5728\u6709\u4e86\u66f4\u6df1\u5165\u7684\u7406\u89e3\u3002<\/p>\n<p>\u5177\u4f53\u800c\u8a00\uff0c\u5728\u6211\u63cf\u8ff0\u7684\u201c\u4f18\u70b9\u201d\u90e8\u5206\uff0c\u6ca1\u6709\u4ec0\u4e48\u771f\u6b63\u7684\u4e0d\u8db3\u4e4b\u5904\uff0c\u4f46\u56de\u987e\u8fc7\u53bb\uff0c\u6211\u5bf9\u5e76\u53d1\u5e26\u6765\u7684\u6743\u8861\u6709\u4e86\u66f4\u6df1\u7684\u8ba4\u8bc6\u3002<\/p>\n<p>\u6211\u66fe\u5199\u5230\uff1a<\/p>\n<blockquote><p>Go \u7684\u5e76\u53d1\u5904\u7406\u65b9\u5f0f\uff0c\u5c31\u5982\u540c\u4f60\u5728\u521a\u5f00\u59cb\u5b66\u4e60\u5e76\u53d1\u65f6\u6240\u8bbe\u60f3\u7684\u90a3\u6837\uff0c\u975e\u5e38\u6613\u4e8e\u7406\u89e3\u548c\u4f7f\u7528\u3002\u5982\u679c\u4f60\u60f3\u5e76\u53d1\u5730\u8fd0\u884c\u4e00\u4e2a\u51fd\u6570\uff0c\u53ea\u9700\u8981\u4f7f\u7528\u00a0go function(arguments)\u3002\u5982\u679c\u4f60\u9700\u8981\u8ba9\u51fd\u6570\u95f4\u8fdb\u884c\u901a\u4fe1\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u901a\u9053\uff0c\u8fd9\u4e9b\u901a\u9053\u9ed8\u8ba4\u4f1a\u540c\u6b65\u6267\u884c\uff0c\u5373\u5728\u4e24\u7aef\u90fd\u51c6\u5907\u5c31\u7eea\u524d\uff0c\u4f1a\u6682\u505c\u6267\u884c\u3002<\/p><\/blockquote>\n<p>\u8fd9\u4e2a\u89c2\u70b9\u4ecd\u7136\u662f\u6b63\u786e\u7684\uff0c\u6211\u4f9d\u7136\u8ba4\u4e3a\u5728 Go \u4e2d\u5904\u7406\u5e76\u53d1\u6bd4\u5728 Python \u4e2d\u8981\u7b80\u5355\u5f97\u591a\u3002\uff08\u987a\u4fbf\u8bf4\u4e00\u53e5\uff0c\u6211\u5199\u4e0b\u8fd9\u4e9b\u89c2\u70b9\u662f\u5728 JavaScript \u6dfb\u52a0\u4e86\u00a0Promise\u00a0\u548c\u00a0await\u00a0\u4e4b\u524d\u3002\uff09\u7136\u800c\uff0c\u7c7b\u578b\u7cfb\u7edf\u5e76\u4e0d\u80fd\u963b\u6b62\u4f60\u521b\u5efa\u6570\u636e\u7ade\u4e89\uff0c\u56e0\u6b64\u5728\u6d4b\u8bd5\u8fc7\u7a0b\u4e2d\u4f60\u5fc5\u987b\u5728\u4f9d\u8d56\u6570\u636e\u7ade\u4e89\u68c0\u6d4b\u5668\uff0c\u5982\u679c\u4f60\u5728\u4e0d\u9075\u5faa\u516c\u8ba4\u7684\u6a21\u5f0f\u7684\u60c5\u51b5\u4e0b\u76f4\u63a5\u4f7f\u7528\u901a\u9053\u521b\u5efa\u7ed3\u6784\u5316\u5e76\u53d1\uff0c\u8fd9\u4f1a\u5bfc\u81f4\u4ee3\u7801\u6df7\u4e71\u3002\u8fd9\u662f\u4e00\u79cd\u6743\u8861\uff0cGo \u7ed9\u4f60\u5145\u8db3\u7684\u81ea\u7531\u4ee5\u81f3\u4e8e\u53ef\u80fd\u81ea\u6211\u9677\u5165\u56f0\u5883\uff0c\u4f46\u5728\u5927\u591a\u6570\u65f6\u5019\uff0c\u5f53\u4f60\u53ea\u662f\u7f16\u5199\u7f51\u7edc\u670d\u52a1\u5668\u6216\u7c7b\u4f3c\u7684\u5e94\u7528\u65f6\uff0c\u4f60\u53ef\u4ee5\u83b7\u5f97\u5e76\u53d1\u7684\u5927\u90e8\u5206\u597d\u5904\uff0c\u800c\u4e0d\u4f1a\u9047\u5230\u592a\u591a\u7684\u9ebb\u70e6\u3002<\/p>\n<p>\u5c31\u6211\u5217\u51fa\u7684\u201c\u7f3a\u70b9\u201d\u90e8\u5206\u6765\u8bf4\uff0c\u5927\u90e8\u5206\u5b9e\u9645\u4e0a\u5e76\u672a\u7ed9\u6211\u5e26\u6765\u592a\u5927\u95ee\u9898\u3002\u6211\u4e0d\u786e\u5b9a\u4e3a\u4f55\u6211\u4f1a\u8fc7\u5ea6\u62c5\u5fe7\u5b57\u7b26\u4e32\u7c7b\u578b\u65e0\u6cd5\u5b9a\u4e49\u65b9\u6cd5\u3002\u811a\u672c\u65e0\u6cd5\u4ee5 #! \u5f00\u5934\u5728\u5b9e\u8df5\u4e2d\u5176\u5b9e\u5e76\u4e0d\u91cd\u8981\u3002Go \u7684\u8bed\u8a00\u8bbe\u8ba1\u5e76\u975e\u5b8c\u5168\u9075\u5faa \u00a0DRY\u00a0\u00a0\uff08<strong>Don&#8217;t repeat yourself<\/strong>\uff0c\u4e0d\u8981\u91cd\u590d\u4f60\u81ea\u5df1\uff09\u539f\u5219\uff0c\u4f46\u8fd9\u66f4\u591a\u7684\u662f\u4e00\u79cd\u6743\u8861\uff0c\u800c\u975e\u201c\u7f3a\u70b9\u201d\u3002<\/p>\n<p>\u867d\u7136\u7f3a\u4e4f\u6cdb\u578b\u6709\u65f6\u4f1a\u5bfc\u81f4\u95ee\u9898\uff0c\u4f46\u901a\u5e38\u6709\u660e\u786e\u7684\u89e3\u51b3\u529e\u6cd5\uff0c\u4f8b\u5982\u4f7f\u7528\u52a8\u6001\u7c7b\u578b\uff0c\u4f7f\u7528\u53cd\u5c04\uff0c\u6216\u8005\u7f16\u5199\u4e00\u4e2a\u4ee3\u7801\u751f\u6210\u5668\u3002\u6211\u5f88\u9ad8\u5174 Go \u73b0\u5728\u5f15\u5165\u4e86\u6cdb\u578b\uff0c\u4f46\u4e8b\u5b9e\u4e0a\uff0c\u6ca1\u6709\u6cdb\u578b\u65f6\u6211\u4eec\u53ea\u4f1a\u5076\u5c14\u9047\u5230\u771f\u6b63\u7684\u95ee\u9898\u3002\u6211\u975e\u5e38\u671f\u5f85\u770b\u5230\u6cdb\u578b\u5982\u4f55\u5f71\u54cd Go \u7684\u672a\u6765\u53d1\u5c55\uff0c\u5c24\u5176\u662f\u5728 Go \u56e2\u961f\u6b63\u5728\u7814\u7a76\u8fed\u4ee3\u5668\u7684\u60c5\u51b5\u4e0b\uff0c\u4f46\u6211\u786e\u5b9e\u6709\u4e9b\u62c5\u5fc3\u53ef\u80fd\u4f1a\u51fa\u73b0\u201c\u6cdb\u578b\u7684\u6ee5\u7528\u201d\uff0c\u5373\u5728\u666e\u901a\u63a5\u53e3\u5df2\u7ecf\u80fd\u591f\u5f88\u597d\u5de5\u4f5c\u7684\u5730\u65b9\u8fc7\u5ea6\u4f7f\u7528\u6cdb\u578b\u3002\u6211\u4eec\u5c06\u62ed\u76ee\u4ee5\u5f85\u3002<\/p>\n<p>\u6211\u5728\u201c\u65e0\u6240\u8c13\u201d\u7684\u90e8\u5206\u5217\u51fa\u7684\u5927\u90e8\u5206\u4e8b\u9879\uff0c\u5b9e\u9645\u4e0a\u66f4\u591a\u7684\u662f\u6743\u8861\uff0c\u7136\u800c\u4e8b\u540e\u770b\u6765\uff0c\u6211\u8ba4\u4e3a Go \u5728\u5b83\u6240\u9009\u62e9\u7684\u8bbe\u8ba1\u8303\u56f4\u5185\u505a\u51fa\u4e86\u66f4\u597d\u7684\u51b3\u5b9a\u3002\u6ca1\u6709\u5f02\u5e38\u673a\u5236\u662f\u4e00\u79cd\u6743\u8861\uff0c\u867d\u7136\u6211\u53ef\u80fd\u5e0c\u671b Go \u6709\u50cf Zig \u7684\u00a0try\u00a0\u548c\u00a0errdefer\u00a0\u90a3\u6837\u7684\u529f\u80fd\uff0c\u4f46\u5b9e\u9645\u4e0a\uff0c\u5f53\u524d\u7684\u65b9\u5f0f\u662f\u53ef\u884c\u7684\u3002\u5c3d\u7ba1\u4f7f\u7528\u00a0if err != nil\u00a0\u662f\u76ee\u524d\u4e3a\u6b62\u6700\u5dee\u7684\u9009\u62e9\uff0c\u9664\u53bb\u6240\u6709\u5176\u4ed6\u4e0d\u5b9a\u671f\u8bd5\u9a8c\u7684\u7cfb\u7edf\uff0c\u4f46\u4e8b\u5b9e\u8bc1\u660e\uff0c\u5b83\u80fd\u4fc3\u4f7f\u7528\u6237\u4ee3\u7801\u6709\u7528\u7684\u6f14\u53d8\u3002<\/p>\n<p>\u5982 \u00a0Matklad \u00a0\u5728\u4e00\u6761\u6700\u8fd1\u7684\u8bc4\u8bba\u4e2d\u6240\u8bf4\uff0c<\/p>\n<blockquote><p>\u770b\u6765\u5728\u9519\u8bef\u5904\u7406\u4e0a\uff0c\u6211\u4eec\uff08\u5f00\u53d1\u8005\u793e\u533a\uff09\u5927\u81f4\u8fbe\u6210\u4e86\u5171\u8bc6\u3002Midori\u3001Go\u3001Rust\u3001Swift\u3001Zig \u5728\u8bbe\u8ba1\u4e0a\u6709\u7740\u76f8\u4f3c\u4e4b\u5904\uff0c\u8fd9\u5e76\u975e\u5b8c\u5168\u662f\u68c0\u67e5\u5f02\u5e38\uff0c\u4f46\u5374\u975e\u5e38\u63a5\u8fd1\u3002<\/p>\n<p>1\u3001\u6709\u4e00\u79cd\u6807\u8bb0\u51fd\u6570\u53ef\u80fd\u4f1a\u5931\u8d25\u7684\u65b9\u5f0f\u3002\u8fd9\u901a\u5e38\u662f\u8fd4\u56de\u7c7b\u578b\u7684\u5c5e\u6027\uff0c\u800c\u4e0d\u662f\u51fd\u6570\u672c\u8eab\u7684\u5c5e\u6027\uff08Rust \u4e2d\u7684 Result\uff0cGo \u4e2d\u7684\u9519\u8bef\u5bf9\uff0cZig \u4e2d\u7684\u00a0!\u00a0\u7c7b\u578b\uff0c\u4ee5\u53ca Midori \u548c Swift \u4e2d\u7684 bare throws decl\uff09<\/p>\n<p>2\u3001\u6211\u4eec\u4e0d\u4ec5\u6807\u8bb0\u629b\u51fa\u5f02\u5e38\u7684\u51fd\u6570\u58f0\u660e\uff0c\u8fd8\u4f1a\u6807\u8bb0\u8c03\u7528\u5904\uff08Midori\u3001Swift\u3001Zig \u4e2d\u7684\u00a0try\uff0cRust \u4e2d\u7684 ?\uff0cGo \u4e2d\u7684\u00a0if err != nil\uff09\u3002<\/p>\n<p>3\u3001\u9ed8\u8ba4\u5b58\u5728\u4e00\u4e2a\u00a0AnyError\u00a0\u7c7b\u578b\uff08Go \u4e2d\u7684\u00a0error\uff0cSwift \u4e2d\u7684\u00a0Error\uff0cRust \u4e2d\u7684\u00a0anyhow\uff0cZig \u4e2d\u7684\u00a0anyerror\uff09\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u533a\u5206\u662f\u5426\u6709\u9519\u8bef\u7684\u4ef7\u503c\uff0c\u5927\u4e8e\u8be6\u5c3d\u5730\u6307\u5b9a\u9519\u8bef\u96c6\u5408\u3002<\/p><\/blockquote>\n<p>\u8fd9\u79cd\u89c2\u70b9\u5bf9\u6211\u6765\u8bf4\u662f\u5408\u7406\u7684\u3002Go \u7684\u9519\u8bef\u5904\u7406\u76f8\u6bd4\u5176\u4ed6\u8bed\u8a00\u66f4\u4e3a\u7e41\u7410\uff0c\u4f46\u4ece\u7ed3\u6784\u4e0a\u6765\u770b\uff0c\u5b83\u4eec\u5728\u5e95\u5c42\u6709\u8bb8\u591a\u5171\u540c\u4e4b\u5904\u3002<\/p>\n<p>\u6211\u66fe\u628a Go \u7f3a\u4e4f\u64cd\u4f5c\u7b26\u91cd\u8f7d\u3001\u51fd\u6570\/\u65b9\u6cd5\u91cd\u8f7d\u6216\u5173\u952e\u5b57\u53c2\u6570\u7b49\u7279\u6027\u5f52\u5165\u201c\u65e0\u6240\u8c13\u201d\u7684\u90e8\u5206\uff0c\u4f46\u73b0\u5728\u6211\u5bf9\u8fd9\u79cd\u72b6\u6001\u611f\u5230\u975e\u5e38\u6ee1\u610f\u3002\u6211\u5e0c\u671b Go \u6709\u64cd\u4f5c\u7b26\u91cd\u8f7d\u7684\u552f\u4e00\u60c5\u51b5\u662f \u00a0big.Int \uff0c\u6211\u5e0c\u671b\u6709\u4e00\u5929\u8fd9\u4e9b\u7279\u6027\u4f1a\u88ab\u6dfb\u52a0\u5230\u8bed\u8a00\u672c\u8eab\u4e2d\u3002\u5173\u952e\u5b57\u53c2\u6570\u53ef\u80fd\u662f\u597d\u7684\uff0c\u4f46\u5b9e\u9645\u4e0a\uff0c\u7ed3\u6784\u4f53\u5c31\u591f\u7528\u4e86\uff0c\u5982\u679c\u6709\u771f\u6b63\u68d8\u624b\u7684\u60c5\u51b5\uff0c\u603b\u662f\u6709 \u65b9\u6cd5\u94fe\u7684\u6784\u5efa\u5668\u53ef\u7528\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13971\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2023\/07\/4ffce04d92a4d6cb21c1494cdfcd6dc1-35.png\" width=\"120\" height=\"96\" alt=\"\u56fe\u7247\" \/><\/p>\n<h2><strong>\u603b\u7ed3<\/strong><\/h2>\n<p>\u5728\u64b0\u5199\u8fd9\u7bc7\u6587\u7ae0\u524d\uff0c \u6211\u539f\u4ee5\u4e3a\u8bfb\u8005\u4eec\u4f1a\u5173\u6ce8\u6211\u5bf9\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b\u7684\u6279\u8bc4\uff0c\u7136\u800c\uff0c\u5b9e\u9645\u4e0a\u4ed6\u4eec\u66f4\u5728\u610f\u7684\u662f\u6211\u7528\u201c\u767d\u75f4\u201d\u4e00\u8bcd\u63cf\u8ff0\u4e89\u8bba\u516c\u6709\/\u79c1\u6709\u5b57\u6bb5\u95ee\u9898\u7684\u4eba\u3002<\/p>\n<p>\u6211\u5728\u6587\u7ae0\u4e2d\u63d0\u51fa\u7684\u6700\u5927\u7591\u95ee\u53ef\u80fd\u662f Go \u8bed\u8a00\u5bf9\u63a5\u53e3\u7684\u8fd0\u7528\u4ee5\u53ca\u7ee7\u627f\u7279\u6027\u7684\u7f3a\u5931\u3002\u6211\u8ba4\u4e3a\u8fd9\u662f\u4e00\u4e2a\u597d\u4e3b\u610f\uff0c\u4f46\u4e5f\u6b22\u8fce\u5b9e\u8df5\u7684\u68c0\u9a8c\uff0c\u5e76\u671f\u5f85\u542c\u5230\u4e0d\u540c\u7684\u89c2\u70b9\u3002Hynek Schlawack \u5728 2021 \u5e74\u53d1\u8868\u7684\u4e00\u7bc7\u6781\u4f73\u7684\u6587\u7ae0\u89e3\u91ca\u4e86\u4e3a\u4ec0\u4e48\u63a5\u53e3\u7684\u8fd0\u7528\u4ee5\u53ca\u6ca1\u6709\u7ee7\u627f\u53ef\u4ee5\u88ab\u770b\u4f5c\u662f Go \u7684\u4f18\u79c0\u8bbe\u8ba1\u9009\u62e9\u3002\u7b80\u5355\u6765\u8bf4\uff0c\u53ea\u6709\u5728\u5b50\u7c7b\u8986\u5199\u8d85\u7c7b\u65b9\u6cd5\u7684\u60c5\u51b5\u4e0b\uff0c\u7ee7\u627f\u624d\u6709\u610f\u4e49\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0cGo \u7684\u7c7b\u578b\u5d4c\u5165\u8868\u73b0\u5f97\u5341\u5206\u51fa\u8272\u3002\u56e0\u6b64\uff0c\u6211\u7ec8\u4e8e\u6fc0\u8d77\u4e86\u6211\u671f\u5f85\u5df2\u4e45\u7684\u8ba8\u8bba\uff0c\u5c3d\u7ba1\u8fd9\u82b1\u4e86\u5927\u7ea6\u516b\u5e74\u7684\u65f6\u95f4\u3002<\/p>\n<p>\u76f4\u5230 2019 \u5e74\uff0cDan Abramov \u624d\u5bf9 Hacker News \u7684\u5199\u4f5c\u7ecf\u9a8c\u8fdb\u884c\u4e86\u6df1\u5165\u7684\u89e3\u8bfb\uff1a<\/p>\n<blockquote><p>\u606d\u559c\u4f60\uff01<\/p>\n<p>\u4f60\u7684\u9879\u76ee\u6210\u4e3a\u4e86\u70ed\u95e8\u65b0\u95fb\u805a\u5408\u5668\u7684\u5934\u6761\u3002\u793e\u533a\u91cc\u7684\u4e00\u4e9b\u77e5\u540d\u4eba\u58eb\u4e5f\u5728\u63a8\u7279\u4e0a\u63d0\u5230\u4e86\u5b83\u3002\u4ed6\u4eec\u5728\u8bf4\u4e9b\u4ec0\u4e48\uff1f<\/p>\n<p>\u4f60\u611f\u5230\u5fc3\u60c5\u6c89\u91cd\u3002<\/p>\n<p>\u5e76\u4e0d\u662f\u8bf4\u4eba\u4eec\u4e0d\u559c\u6b22\u8fd9\u4e2a\u9879\u76ee\u3002\u4f60\u6e05\u695a\u9879\u76ee\u5b58\u5728\u6743\u8861\uff0c\u4e5f\u671f\u5f85\u4eba\u4eec\u4f1a\u5bf9\u6b64\u8fdb\u884c\u8ba8\u8bba\u3002\u4f46\u662f\u4e8b\u60c5\u5e76\u672a\u5982\u9884\u671f\u53d1\u751f\u3002<\/p>\n<p><strong>\u7136\u800c\uff0c\u8bc4\u8bba\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u5e76\u4e0d\u5173\u5fc3\u4f60\u7684\u60f3\u6cd5\u3002<\/strong><\/p>\n<p>\u6700\u70ed\u95e8\u7684\u8bc4\u8bba\u4e3b\u9898\u662f\u56f4\u7ed5 README \u793a\u4f8b\u4e2d\u7684\u7f16\u7801\u98ce\u683c\u3002\u5b83\u6f14\u53d8\u6210\u4e86\u4e00\u4e2a\u5173\u4e8e\u7f29\u8fdb\u7684\u4e89\u8bba\uff0c\u6709\u4e00\u767e\u591a\u6761\u56de\u590d\uff0c\u5e76\u5bf9\u4e0d\u540c\u7684\u7f16\u7a0b\u8bed\u8a00\u5982\u4f55\u5904\u7406\u683c\u5f0f\u8fdb\u884c\u4e86\u7b80\u77ed\u7684\u5386\u53f2\u56de\u987e\u3002\u5176\u4e2d\u5fc5\u7136\u4f1a\u63d0\u5230 gofmt \u548c Python\u3002\u4f60\u4f7f\u7528\u8fc7 Prettier \u5417\uff1f<\/p><\/blockquote>\n<p>\u2026<\/p>\n<blockquote><p><strong>\u4f60\u611f\u5230\u56f0\u60d1\uff0c\u5173\u95ed\u4e86\u6807\u7b7e\u9875\u3002<\/strong><\/p>\n<p>\u53d1\u751f\u4e86\u4ec0\u4e48\uff1f<\/p>\n<p>\u4e5f\u8bb8\u662f\u4f60\u7684\u60f3\u6cd5\u7b80\u5355\u5730\u4e0d\u50cf\u4f60\u60f3\u8c61\u7684\u90a3\u6837\u6709\u8da3\u3002\u4e5f\u53ef\u80fd\u662f\u4f60\u5bf9\u5076\u7136\u8bbf\u95ee\u7684\u4eba\u89e3\u91ca\u5f97\u4e0d\u591f\u597d\u3002<\/p>\n<p>\u4f46\u662f\uff0c\u4f60\u53ef\u80fd\u6ca1\u6709\u5f97\u5230\u76f8\u5173\u53cd\u9988\u7684\u53e6\u4e00\u4e2a\u539f\u56e0\u3002<\/p>\n<p><strong>\u6211\u4eec\u66f4\u504f\u5411\u4e8e\u63a2\u8ba8\u90a3\u4e9b\u76f8\u5bf9\u5bb9\u6613\u8ba8\u8bba\u7684\u8bdd\u9898\u3002<\/strong><\/p><\/blockquote>\n<p>\u6211\u5df2\u7ecf\u63a5\u53d7\u4e86\u8fd9\u6837\u4e00\u4e2a\u4e8b\u5b9e\uff1a\u8bba\u575b\u4e0a\u7684\u4eba\u4eec\uff08\u5305\u62ec\u6211\u81ea\u5df1\uff09\u66f4\u5bb9\u6613\u5173\u6ce8\u81ea\u5df1\u5df2\u7ecf\u60f3\u5230\u7684\u4e8b\u60c5\uff0c\u800c\u975e\u6587\u7ae0\u6240\u8ba8\u8bba\u7684\u4e3b\u9898\u3002\u8fd9\u5c31\u662f\u73b0\u5b9e\uff0c\u77ed\u671f\u5185\u6050\u6015\u65e0\u6cd5\u6539\u53d8\u3002<\/p>\n<p>\u6211\u8ba4\u4e3a Rachel \u7684 \u00a0Run XOR Use \u89c4\u5219 \uff08\u8981\u4e48\u4f7f\u7528\u4e00\u4e2a\u804a\u5929\u7a97\u53e3\u6216\u7559\u8a00\u677f\uff0c\u4f46\u4e0d\u80fd\u540c\u65f6\u505a\u4e24\u8005\u3002\u8fd9\u662f\u4e3a\u4e86\u907f\u514d\u51b2\u7a81\u548c\u5206\u6563\u6ce8\u610f\u529b\u3002\uff09\u540c\u6837\u9002\u7528\u4e8e\u64b0\u5199\u548c\u8ba8\u8bba\u535a\u5ba2\u6587\u7ae0\u3002\u5982\u679c\u4f60\u53d1\u5e03\u4e86\u6587\u7ae0\uff0c\u4f60\u5fc5\u987b\u9884\u5907\u597d\u8ba8\u8bba\u4f1a\u6269\u5c55\u5230\u4f60\u81ea\u5df1\u90fd\u672a\u66fe\u9884\u89c1\u7684\u9886\u57df\u3002<\/p>\n<p>\u5bf9\u4e8e Go \u8bed\u8a00\uff0c\u6211\u73b0\u5728\u7684\u6ee1\u610f\u5ea6\u8d85\u8fc7\u4e86\u4ee5\u5f80\u7684\u4efb\u4f55\u65f6\u671f\u3002\u867d\u7136\u5b83\u7684\u901f\u5ea6\u5e76\u4e0d\u5982 Rust\uff0c\u4f46\u5df2\u7ecf\u8d85\u8fc7\u4e86\u6211\u7684\u9700\u6c42\uff0c\u540c\u65f6\u5e76\u65e0\u8fc7\u5ea6\u7684\u6a21\u677f\u4ee3\u7801\u6216\u62bd\u8c61\u6982\u5ff5\u8bf1\u60d1\u3002\u6211\u8ba4\u4e3a GO \u8bed\u8a00\u56e2\u961f\u5177\u6709\u826f\u597d\u7684\u6d1e\u5bdf\u529b\uff0c\u4ed6\u4eec\u603b\u662f\u7a33\u5065\u5730\u5411\u6b63\u786e\u7684\u65b9\u5411\u524d\u8fdb\u3002\u6211\u671f\u5f85\u770b\u5230\u5b83\u672a\u6765\u7684\u53d1\u5c55\u3002<\/p>\n<p>\u9884\u6d4b\u603b\u662f\u5f88\u96be\u7684\uff0c\u5c24\u5176\u662f\u5bf9\u4e8e\u672a\u6765\u7684\u4e8b\u7269\u3002\u5341\u5e74\u540e\u6211\u8fd8\u4f1a\u4f7f\u7528 Go \u5417\uff1f\u6211\u65e0\u6cd5\u786e\u5b9a\u3002\u9884\u671f\u4e2d\u7684\u5341\u5e74\u603b\u4f3c\u4e4e\u6bd4\u56de\u987e\u4e2d\u7684\u65f6\u95f4\u8981\u957f\u3002\u4e5f\u8bb8\u90a3\u65f6\u6211\u4eec\u53ea\u662f\u5728\u68c0\u67e5\u7531 AI \u751f\u6210\u7684\u4ee3\u7801\u7684\u8f93\u51fa\uff0c\u867d\u7136\u8fd9\u542c\u8d77\u6765\u6709\u4e9b\u6d88\u6781\u3002\u4f46\u81f3\u5c11\u73b0\u5728\uff0c\u6211\u4e50\u610f\u5c06\u5b83\u4f5c\u4e3a\u6211\u7684\u4e3b\u8981\u7f16\u7a0b\u8bed\u8a00\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u90a3\u7bc7\u6587\u7ae0\u7684\u539f\u59cb\u7ed3\u8bba\uff0c\u4ee5\u53ca\u6211\u5728 2023 \u5e74\u7684\u66f4\u65b0\uff1a<\/p>\n<blockquote><p>Go \u771f\u7684\u5f88\u68d2\uff0c\u5b83\u5df2\u7ecf\u6210\u4e3a\u6211\u7684\u65e5\u5e38\u8bed\u8a00\uff08\u5b83\u66fe\u7ecf\u662f Python \uff09\uff0c\u800c\u4e14\u5b83\u7edd\u5bf9\u662f\u4e00\u79cd\u8da3\u5473\u5341\u8db3\u7684\u8bed\u8a00\uff0c\u975e\u5e38\u9002\u5408\u5904\u7406\u5927\u578b\u9879\u76ee\u3002\u5982\u679c\u4f60\u6709\u5174\u8da3\u5b66\u4e60 Go\uff0c\u6211\u5efa\u8bae\u5b66\u4e60\u4e0b\u8fd9\u4e2a\u7b80\u5355\u7684\u6559\u7a0b\uff0c\u7136\u540e\u5728\u5c06\u6d4b\u8bd5\u7a0b\u5e8f\u8f93\u5165\u5230 \u00a0Playground \u4e2d\u8fd0\u884c\uff0c\u5e76\u4e14\u8ba4\u771f\u5b66\u4e60 GO \u8bed\u8a00\u89c4\u8303\u3002\u8be5\u89c4\u8303\u7b80\u6d01\u6613\u8bfb\uff0c\u662f\u5b66\u4e60 Go \u975e\u5e38\u597d\u7684\u5b66\u4e60\u6750\u6599\u3002<\/p><\/blockquote>\n<p>\u8ba9\u6211\u4eec\u5728 2033 \u5e74\u518d\u4f1a\uff0c\u5c4a\u65f6\u6211\u4eec\u5c06\u4f1a\u5728 \u201c\u201c\u201cGo \u8bed\u8a00\uff1a\u4f18\u70b9\u3001\u7f3a\u70b9\u548c\u5e73\u6de1\u65e0\u5947\u4e4b\u5904\u201d \u5341\u5e74&#8221;\u5341\u5e74\u201d \u4e2d\u76f8\u89c1\u3002<\/p>\n<p>\u4f60\u4e5f\u6b63\u5728\u4f7f\u7528 GO \u8bed\u8a00\u7f16\u7a0b\u5417\uff1f\u4f60\u8ba4\u540c\u4f5c\u8005\u7684\u8bf4\u6cd5\u5417\uff1f\u4f60\u5bf9 GO \u8bed\u8a00\u600e\u4e48\u770b\uff1f\u6b22\u8fce\u5728\u8bc4\u8bba\u533a\u8ba8\u8bba\u3002<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_13966\" class=\"pvc_stats total_only  \" data-element-id=\"13966\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/aif.amtbbs.org\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5341\u5e74\u524d\uff0c\u6211\u64b0\u5199\u4e86\u4e00\u7bc7\u540d\u4e3aGo \u8bed\u8a00\uff1a\u4f18\u70b9\u3001\u7f3a\u70b9\u548c\u5e73\u6de1\u65e0\u5947\u4e4b\u5904\u3002\u8be5\u7bc7\u6587\u7ae0\u5728 2013 \u5e74\u51b2\u4e0a\u4e86Hacker Ne [&hellip;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_13966\" class=\"pvc_stats total_only  \" data-element-id=\"13966\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/aif.amtbbs.org\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":8,"featured_media":13967,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-13966","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai"],"_links":{"self":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/13966","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/comments?post=13966"}],"version-history":[{"count":1,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/13966\/revisions"}],"predecessor-version":[{"id":13972,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/13966\/revisions\/13972"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/media\/13967"}],"wp:attachment":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/media?parent=13966"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/categories?post=13966"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/tags?post=13966"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}