{"id":10006850,"date":"2022-11-17T00:01:33","date_gmt":"2022-11-16T16:01:33","guid":{"rendered":"https:\/\/ityet.com\/?p=10006850"},"modified":"2022-11-17T00:01:33","modified_gmt":"2022-11-16T16:01:33","slug":"%e5%89%8d%e7%ab%af%e5%a6%82%e4%bd%95%e5%85%a5%e9%97%a8-go-%e8%af%ad%e8%a8%80","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10006850","title":{"rendered":"\u524d\u7aef\u5982\u4f55\u5165\u95e8 Go \u8bed\u8a00"},"content":{"rendered":"<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<h2>\u8bed\u6cd5\u5bf9\u6bd4<\/h2>\n<h3>import \u5305\u65b9\u5f0f<\/h3>\n<p>Go \u8bed\u8a00\u7684\u5305\u5bfc\u5165\u65b9\u5f0f\u4e0e\u524d\u7aef\u7684\u6a21\u5757\u5bfc\u5165\u65b9\u5f0f\u7c7b\u4f3c\uff0c\u90fd\u662f\u901a\u8fc7 import \u5173\u952e\u5b57\u5bfc\u5165\uff0c\u4f46\u662f Go \u8bed\u8a00\u7684\u5bfc\u5165\u65b9\u5f0f\u66f4\u52a0\u7b80\u6d01\uff0c\u53ea\u9700\u8981\u5199\u5305\u540d\u5373\u53ef\uff0c\u4e0d\u9700\u8981\u5199\u8def\u5f84\u3002<\/p>\n<pre><code>\/\/ js\nimport a from &quot;a&quot;;\nimport b from &quot;b&quot;\n\n\/\/ go\nimport (\n    &quot;a&quot;\n    &quot;b&quot;\n)\n<\/code><\/pre>\n<h3>\u53d8\u91cf\u58f0\u660e<\/h3>\n<pre><code>\/\/ js\nvar a = &quot;a&quot;;\nlet b = &quot;b&quot;;\nconst c = &quot;c&quot;;\n\n\/\/ go\nvar x string = &quot;x&quot;;\nx := &quot;x&quot; \/\/ \u81ea\u52a8\u628a\u53d8\u91cf\u7c7b\u578b\u3001\u58f0\u660e\u548c\u8d4b\u503c\u90fd\u641e\u5b9a\u4e86<\/code><\/pre>\n<h3>\u6761\u4ef6<\/h3>\n<pre><code>\/\/ js\nif (a === &quot;js&quot;) {\n\n} else {\n\n}\n\n\/\/ go\nif a == &quot;go&quot; {\n\n} else {\n\n}<\/code><\/pre>\n<h3>\u5faa\u73af<\/h3>\n<pre><code>\/\/ js\nfor(let i = 0; i &lt; 100; i++) {\n\n}\n\n\/\/ go\nfor i := 0; i &lt; 100; i++ {\n\n}<\/code><\/pre>\n<h3>\u51fd\u6570<\/h3>\n<pre><code>\/\/ js\nfunction helloJS() {\n    console.log(&quot;hello js&quot;);\n\n    learnJS();\n}\n\nfunction learnJS() {\n    console.log(&quot;learn js&quot;);\n}\n\n\/\/ go\nfunc helloGo() {\n    fmt.Println(&quot;hello go&quot;);\n}\n\nfunc learnGo() {\n    fmt.Println(&quot;learn go&quot;);\n\n    learnGo();\n}<\/code><\/pre>\n<p>\u5728\u8bed\u6cd5\u5c42\u9762\u7684\u76f8\u4f3c\u4e4b\u5904\uff0c\u52a0\u6df1\u4e86\u6211\u5bf9 Go \u7684\u7406\u89e3\uff0c\u8ba9\u6211\u66f4\u5bb9\u6613\u4e0a\u624b Go\u3002<\/p>\n<h2>\u642d\u5efa\u7f51\u7ad9<\/h2>\n<p>\u7f51\u7ad9\u5730\u5740\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=V69Hd%2B6qRDGBJPVQriPEkw%3D%3D.XY4nj2Wh87%2BdKxoZfxL2Ol3WVRiwqlbIIUID11QtWzQ%3D\" rel=\"nofollow\">https:\/\/daily.rnode.me\/<\/a><br \/>Github \u5730\u5740\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=nKo6SoL7hqIAkJE7J8pC%2Bw%3D%3D.yC3Xbb5E1rt6%2F6G%2FnT3MY6Zz%2BHBvxp%2FYxZcwFgFdHWBotPQ3EcXFF0XB6dup8Fre\" rel=\"nofollow\">https:\/\/github.com\/robinv8\/daily<\/a><\/p>\n<p>\u8bb0\u5f55\u65e5\u5e38\u770b\u5230\u7684\u6709\u8da3\u7684\u5185\u5bb9\u3002<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042825272\" alt=\"image\" title=\"image\" loading=\"lazy\"><\/p>\n<h2>\u4e3a\u4ec0\u4e48\u8981\u505a<\/h2>\n<p>\u524d\u7aef\u6784\u5efa\u7f16\u8bd1\u65b9\u5411\u6d8c\u73b0\u51fa <a href=\"https:\/\/link.segmentfault.com\/?enc=ycnAh5EDUeEZCqvBl5OSjw%3D%3D.vJWD0BCULIrD5iDA1aU%2Fm158%2Ficp3PkjHYlFRXn7aQQ%3D\" rel=\"nofollow\">esbuild<\/a>\u3001<a href=\"https:\/\/link.segmentfault.com\/?enc=hsHEET5LqmVPWC6eOpb%2B2w%3D%3D.RVy2EW0iiSGw9P2Om%2FitcQ%3D%3D\" rel=\"nofollow\">swc<\/a>\u3001<a href=\"https:\/\/link.segmentfault.com\/?enc=2%2B7qmbrQdywx%2BR6tK57kdA%3D%3D.CQZMZJXnohWZwd7%2BYSfmYHgI%2F819DCe7YiNt1YSpQ4g%3D\" rel=\"nofollow\">turbopack<\/a> \u7b49\u4e0b\u4e00\u4ee3\u6784\u5efa\u5de5\u5177\uff0c\u5927\u5e45\u63d0\u5347\u7f16\u8bd1\u901f\u5ea6\u3002\u5176\u6b21\uff0c\u516c\u53f8\u540e\u7aef\u6280\u672f\u6808\u8f6c\u5411 <a href=\"https:\/\/link.segmentfault.com\/?enc=zMrPJsMQWbo%2BnwtesJcDiQ%3D%3D.xrFzcsDyI9s8T9wo8EyhuA%3D%3D\" rel=\"nofollow\">Go<\/a>\uff0c\u5927\u5bb6\u90fd\u8bf4\u5f88\u7b80\u5355\uff0c\u56e0\u6b64\u6709\u4e86\u8fd9\u4e2a\u60f3\u6cd5\u3002<\/p>\n<h2>\u6280\u672f\u6808<\/h2>\n<ul>\n<li>\u524d\u7aef\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=Q%2FKZa3KE8sfhl5uZgD6U1A%3D%3D.pHWgvfYiTekDz4EkSQ1EkpCAjl9SAccPZph8tVjtZko%3D\" rel=\"nofollow\">Astro<\/a><\/li>\n<li>\u540e\u7aef\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=LDc%2B5KwuT8kqKO3Cj1mefA%3D%3D.FP5owGhCyoHQihHu9xSN3w%3D%3D\" rel=\"nofollow\">Go<\/a><\/li>\n<li>\u6570\u636e\u5e93\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=%2Bt7kRVOTrO7udJCwAnKs4g%3D%3D.Q7ifFoC4Ud2kTyt%2B7B%2FIuf2q4iP1%2F4VnPBxFLuX%2B60E%3D\" rel=\"nofollow\">PostgreSQL<\/a><\/li>\n<\/ul>\n<h2>\u53c2\u8003<\/h2>\n<ul>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=0MXGyasKFr51Kx5D%2FBZ20g%3D%3D.HVZ5GkcoteQ2PM38AtON7twq9wRF5asc8rymk7IyrX8%3D\" rel=\"nofollow\">tw93\/weekly<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=bAnICw%2FqxNQ9PLFKxZO94g%3D%3D.8S1K7fyPsJMKWTsVRQ45wJ2oHagpTR0ertc4%2FAmJvYs%3D\" rel=\"nofollow\">Learn X in Y minutes<\/a><\/li>\n<\/ul>\n<h2>\u603b\u7ed3<\/h2>\n<p>\u901a\u8fc7\u8fd9\u4e2a\u9879\u76ee\uff0c\u6211\u5b66\u4e60\u5230\u4e86 Go \u8bed\u8a00\u7684\u57fa\u7840\u8bed\u6cd5\uff0c\u540e\u671f\u4f1a\u4e0d\u65ad\u5b8c\u5584\u8be5\u9879\u76ee\uff0c\u52a0\u5165\u66f4\u591a\u529f\u80fd\u3002\u4ee5\u6b64\u6765\u5de9\u56fa Go \u8bed\u8a00\u7684\u77e5\u8bc6\u3002<\/p>\n<blockquote><p>\u672c\u6587\u53c2\u4e0e\u4e86<a href=\"https:\/\/segmentfault.com\/a\/1190000042741155\">\u601d\u5426\u6280\u672f\u5f81\u6587<\/a>\uff0c\u6b22\u8fce\u6b63\u5728\u9605\u8bfb\u7684\u4f60\u4e5f\u52a0\u5165\u3002<\/p><\/blockquote>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000042825269\">https:\/\/segmentfault.com\/a\/1190000042825269<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<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 [&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-10006850","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\/10006850","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=10006850"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006850\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10006850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10006850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10006850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}