{"id":1273,"date":"2024-12-13T23:18:26","date_gmt":"2024-12-13T15:18:26","guid":{"rendered":"https:\/\/blog.viter.top\/?p=1273"},"modified":"2024-12-13T23:41:01","modified_gmt":"2024-12-13T15:41:01","slug":"go%e8%af%ad%e8%a8%80%e5%ad%a6%e4%b9%a0%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"https:\/\/blog.viter.top\/index.php\/2024\/12\/13\/go%e8%af%ad%e8%a8%80%e5%ad%a6%e4%b9%a0%e6%80%bb%e7%bb%93\/","title":{"rendered":"go\u8bed\u8a00\u5b66\u4e60\u603b\u7ed3"},"content":{"rendered":"\n<p>Go\u8bed\u8a00\u5b9a\u4e49\u53d8\u91cf\u3001fmt\u5305\u3001Print\u3001Println\u3001Printf\u3001Go\u8bed\u8a00\u6ce8\u91ca<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u4e00\u3001Go\u8bed\u8a00\u5b9a\u4e49\u53d8\u91cf\n\nGolang\u4e2d\u5e38\u89c1\u7684\u53d8\u91cf\u5b9a\u4e49\u65b9\u6cd5\u5982\u4e0b\uff1a\n1\u3001var\u5b9a\u4e49\u53d8\u91cf\nvar \u53d8\u91cf\u540d \u7c7b\u578b = \u8868\u8fbe\u5f0f\nvar name string = \"zhangsan\"\n\n2\u3001\u7c7b\u578b\u63a8\u5bfc\u65b9\u5f0f\u5b9a\u4e49\u53d8\u91cf\na\u5728\u51fd\u6570\u5185\u90e8\uff0c\u53ef\u4ee5\u4f7f\u7528\u66f4\u7b80\u7565\u7684:=\u65b9\u5f0f\u58f0\u660e\u5e76\u521d\u59cb\u5316\u53d8\u91cf\u3002\u6ce8\u610f\uff1a\u77ed\u53d8\u91cf\u53ea\u80fd\u7528\u4e8e\u58f0\u660e\u5c40\u90e8\u53d8\u91cf\uff0c\u4e0d\u80fd\u7528\u4e8e\u5168\u5c40\u53d8\u91cf\u7684\u58f0\u660e\n\n\u53d8\u91cf\u540d := \u8868\u8fbe\u5f0f\nn := 10\n\n2\u3001\u53d8\u91cf\u540d:=\u8868\u8fbe\u5f0fn:=10\n\n\u4e8c\u3001fmt\u5305\u3001Print\u3001Println\u3001Printf\n\nGo \u4e2d\u8981\u6253\u5370\u4e00\u4e2a\u503c\u9700\u8981\u5f15\u5165 fmt \u5305\nimport \"fmt\"\nfmt \u5305\u91cc\u9762\u7ed9\u6211\u4eec\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5e38\u89c1\u7684\u6253\u5370\u6570\u636e\u7684\u65b9\u6cd5\uff0c\u6bd4\u5982\uff1aPrint \u3001Println\u3001Printf\uff0c\u5728\u6211\u4eec\u5b9e\u9645\u5f00\u53d1\u4e2d Println\u3001Printf \u7528\u7684\u975e\u5e38\u591a\u3002\n1\u3001Print \u548c Println \u533a\u522b\uff1a\n\u4e00\u6b21\u8f93\u5165\u591a\u4e2a\u503c\u7684\u65f6\u5019 Println \u4e2d\u95f4\u6709\u7a7a\u683c Print \u6ca1\u6709\nfmt.Println(\"go\", \"python\", \"php\", \"javascript\") \/\/ go python php javascript\nfmt.Print(\"go\", \"python\", \"php\", \"javascript\") \/\/ gopythonphpjavascript\nPrintln \u4f1a\u81ea\u52a8\u6362\u884c\uff0cPrint \u4e0d\u4f1a\npackage main\nimport \"fmt\"\nfunc main() {\nfmt.Println(\"hello\")\nfmt.Println(\"world\")\n\/\/ hello\n\/\/ world\nfmt.Print(\"hello\")\nfmt.Print(\"world\")\n\/\/ helloworld\n}\n\n\n\n2\u3001Println\u548cPrintf\u533a\u522b\uff1a\n\nPrintf\u662f\u683c\u5f0f\u5316\u8f93\u51fa\uff0c\u5728\u5f88\u591a\u573a\u666f\u4e0b\u6bd4Println\u66f4\u65b9\u4fbf\uff0c\u4e3e\u4e2a\u4f8b\u5b50\uff1a\n\na:=10\nb:=20\nc:=30\nfmt.Println(\"a=\",a,\",b=\",b,\",c=\",c)\/\/a=10,b=20,c=30\nfmt.Printf(\"a=%d,b=%d,c=%d\",a,b,c)\/\/a=10,b=20,c=30\n\n%d \u662f\u5360\u4f4d\u7b26\uff0c\u8868\u793a\u6570\u5b57\u7684\u5341\u8fdb\u5236\u8868\u793a\u3002Printf \u4e2d\u7684\u5360\u4f4d\u7b26\u4e0e\u540e\u9762\u7684\u6570\u5b57\u53d8\u91cf\u4e00\u4e00\u5bf9\u5e94\u3002\u66f4\u591a\u7684\u5360\u4f4d\u7b26\u53c2\u8003\uff1ahttp:\/\/docscn.studygolang.com\/pkg\/fmt\/\n\n\n3\u3001Go \u8bed\u8a00\u4e2d\u7684\u6ce8\u91ca\nwin \u4e0b\u9762 ctrl+\/ \u53ef\u4ee5\u5feb\u901f\u7684\u6ce8\u91ca\u4e00\u6837\uff0cmac \u4e0b\u9762 command+\/ \u4e5f\u53ef\u4ee5\u5feb\u901f\u7684\u6ce8\u91ca\u4e00\u6837\n\n\/* \u8fd9\u662f\u4e00\u4e2a\u6ce8\u91ca\n*\/\n\/\/\u8fd9\u662f\u4e00\u4e2a\u6ce8\u91ca<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Go \u53d8\u91cf\u3001\u5e38\u91cf\u3001\u53d8\u91cf\u547d\u540d\u89c4\u5219<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1\u3001\u53d8\u91cf\u7684\u6765\u5386\n\n\u7a0b\u5e8f\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u7684\u6570\u636e\u90fd\u662f\u4fdd\u5b58\u5728\u5185\u5b58\u4e2d\uff0c\u6211\u4eec\u60f3\u8981\u5728\u4ee3\u7801\u4e2d\u64cd\u4f5c\u67d0\u4e2a\u6570\u636e\u65f6\u5c31\u9700\u8981\u53bb\u5185\u5b58\u4e0a\u627e\u5230\u8fd9\u4e2a\u53d8\u91cf\uff0c\u4f46\u662f\u5982\u679c\u6211\u4eec\u76f4\u63a5\u5728\u4ee3\u7801\u4e2d\u901a\u8fc7\u5185\u5b58\u5730\u5740\u53bb\u64cd\u4f5c\u53d8\u91cf\u7684\u8bdd\uff0c\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u4f1a\u975e\u5e38\u5dee\u800c\u4e14\u8fd8\u5bb9\u6613\u51fa\u9519\uff0c\u6240\u4ee5\u6211\u4eec\u5c31\u5229\u7528\u53d8\u91cf\u5c06\u8fd9\u4e2a\u6570\u636e\u7684\u5185\u5b58\u5730\u5740\u4fdd\u5b58\u8d77\u6765\uff0c\u4ee5\u540e\u76f4\u63a5\u901a\u8fc7\u8fd9\u4e2a\u53d8\u91cf\u5c31\u80fd\u627e\u5230\u5185\u5b58\u4e0a\u5bf9\u5e94\u7684\u6570\u636e\u4e86\u3002\n\n2\u3001\u53d8\u91cf\u7c7b\u578b\n\n\u53d8\u91cf\uff08Variable\uff09\u7684\u529f\u80fd\u662f\u5b58\u50a8\u6570\u636e\u3002\u4e0d\u540c\u7684\u53d8\u91cf\u4fdd\u5b58\u7684\u6570\u636e\u7c7b\u578b\u53ef\u80fd\u4f1a\u4e0d\u4e00\u6837\u3002\u7ecf\u8fc7\u534a\u4e2a\u591a\u4e16\u7eaa\u7684\u53d1\u5c55\uff0c\u7f16\u7a0b\u8bed\u8a00\u5df2\u7ecf\u57fa\u672c\u5f62\u6210\u4e86\u4e00\u5957\u56fa\u5b9a\u7684\u7c7b\u578b\uff0c\u5e38\u89c1\u53d8\u91cf\u7684\u6570\u636e\u7c7b\u578b\u6709\uff1a\u6574\u578b\u3001\u6d6e\u70b9\u578b\u3001\u5e03\u5c14\u578b\u7b49\u3002\nGo \u8bed\u8a00\u4e2d\u7684\u6bcf\u4e00\u4e2a\u53d8\u91cf\u90fd\u6709\u81ea\u5df1\u7684\u7c7b\u578b\uff0c\u5e76\u4e14\u53d8\u91cf\u5fc5\u987b\u7ecf\u8fc7\u58f0\u660e\u624d\u80fd\u5f00\u59cb\u4f7f\u7528\u3002\n\n3\u3001GO \u8bed\u8a00\u4e2d\u53d8\u91cf\u7684\u58f0\u660e\n\nGo \u8bed\u8a00\u53d8\u91cf\u540d\u7531\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u5176\u4e2d\u9996\u4e2a\u5b57\u7b26\u4e0d\u80fd\u4e3a\u6570\u5b57\u3002Go \u8bed\u8a00\u4e2d\u5173\u952e\u5b57\u548c\u4fdd\u7559\u5b57\u90fd\u4e0d\u80fd\u7528\u4f5c\u53d8\u91cf\u540d\u3002\nGo \u8bed\u8a00\u4e2d\u7684\u53d8\u91cf\u9700\u8981\u58f0\u660e\u540e\u624d\u80fd\u4f7f\u7528\uff0c\u540c\u4e00\u4f5c\u7528\u57df\u5185\u4e0d\u652f\u6301\u91cd\u590d\u58f0\u660e\u3002\u5e76\u4e14Go \u8bed\u8a00\u7684\u53d8\u91cf\u58f0\u660e\u540e\u5fc5\u987b\u4f7f\u7528\u3002\n\n1\u3001var \u58f0\u660e\u53d8\u91cf\nvar \u53d8\u91cf\u540d\u79f0 type\n\n\npackage main\nimport \"fmt\";\nfunc main() {\nvar username=\"\u5f20\u4e09\" var age int =20\nfmt.Println(username,age)\n}\n\n2\u3001\u4e00\u6b21\u5b9a\u4e49\u591a\u4e2a\u53d8\u91cf\n\nvar identifier1, identifier2 type\n\npackage main\nimport \"fmt\"\nfunc main() {\nvar username, sex string\nusername = \"\u5f20\u4e09\"\nsex = \"\u7537\"\nfmt.Println(username, sex)\n}\n\u7533\u660e\u53d8\u91cf\u7684\u65f6\u5019\u8d4b\u503c\nvar a, b, c, d = 1, 2, 3, false\n\n\n3\u3001\u6279\u91cf\u58f0\u660e\u53d8\u91cf\u7684\u65f6\u5019\u6307\u5b9a\u7c7b\u578b\n\nvar ( \na string \nb int \nc bool \n) \na = \"\u5f20\u4e09\" \nb = 10 \nc = true \nfmt.Println(a,b,c)\n\n\u6279\u91cf\u58f0\u660e\u53d8\u91cf\u5e76\u8d4b\u503c\n\nvar (\na string = \"\u5f20\u4e09\" \nb int = 20\nc bool = true\n)\nfmt.Println(a, b, c)\nfmt.Println(a,b,c)\n\n4\u3001\u53d8\u91cf\u7684\u521d\u59cb\u5316\n\nGo \u8bed\u8a00\u5728\u58f0\u660e\u53d8\u91cf\u7684\u65f6\u5019\uff0c\u4f1a\u81ea\u52a8\u5bf9\u53d8\u91cf\u5bf9\u5e94\u7684\u5185\u5b58\u533a\u57df\u8fdb\u884c\u521d\u59cb\u5316\u64cd\u4f5c\u3002\u6bcf\u4e2a\u53d8\u91cf\u4f1a\u88ab\u521d\u59cb\u5316\u6210\u5176\u7c7b\u578b\u7684\u9ed8\u8ba4\u503c\uff0c\u4f8b\u5982\uff1a \u6574\u578b\u548c\u6d6e\u70b9\u578b\u53d8\u91cf\u7684\u9ed8\u8ba4\u503c\u4e3a 0\u3002\u5b57\u7b26\u4e32\u53d8\u91cf\u7684\u9ed8\u8ba4\u503c\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002 \u5e03\u5c14\u578b\u53d8\u91cf\u9ed8\u8ba4\u4e3a false\u3002 \u5207\u7247\u3001\u51fd\u6570\u3001\u6307\u9488\u53d8\u91cf\u7684\u9ed8\u8ba4\u4e3anil\u3002\n\n\u5f53\u7136\u6211\u4eec\u4e5f\u53ef\u5728\u58f0\u660e\u53d8\u91cf\u7684\u65f6\u5019\u4e3a\u5176\u6307\u5b9a\u521d\u59cb\u503c\u3002\u53d8\u91cf\u521d\u59cb\u5316\u7684\u6807\u51c6\u683c\u5f0f\u5982\u4e0b\uff1a\nvar \u53d8\u91cf\u540d \u7c7b\u578b = \u8868\u8fbe\u5f0f\n\n\u4e3e\u4e2a\u4f8b\u5b50\uff1a\nvar name string = \"zhangsan\" \nvar age int = 18\n\u6216\u8005\u4e00\u6b21\u521d\u59cb\u5316\u591a\u4e2a\u53d8\u91cf\u5e76\u8d4b\u503c\nvar name, age = \"zhangsan\", 20\n\n\n5\u3001\u7c7b\u578b\u63a8\u5bfc\n\u6709\u65f6\u5019\u6211\u4eec\u4f1a\u5c06\u53d8\u91cf\u7684\u7c7b\u578b\u7701\u7565\uff0c\u8fd9\u4e2a\u65f6\u5019\u7f16\u8bd1\u5668\u4f1a\u6839\u636e\u7b49\u53f7\u53f3\u8fb9\u7684\u503c\u6765\u63a8\u5bfc\u53d8\u91cf\u7684\u7c7b\u578b\u5b8c\u6210\u521d\u59cb\u5316\u3002\nvar name = \"Q1mi\" \nvar age = 18\n\n\n6\u3001\u77ed\u53d8\u91cf\u58f0\u660e\u6cd5\n\u5728\u51fd\u6570\u5185\u90e8\uff0c\u53ef\u4ee5\u4f7f\u7528\u66f4\u7b80\u7565\u7684 := \u65b9\u5f0f\u58f0\u660e\u5e76\u521d\u59cb\u5316\u53d8\u91cf\u3002\n\u6ce8\u610f\uff1a\u77ed\u53d8\u91cf\u53ea\u80fd\u7528\u4e8e\u58f0\u660e\u5c40\u90e8\u53d8\u91cf\uff0c\u4e0d\u80fd\u7528\u4e8e\u5168\u5c40\u53d8\u91cf\u7684\u58f0\u660e\n\n\u53d8\u91cf\u540d := \u8868\u8fbe\u5f0f\n\npackage main\nimport ( \n\"fmt\"\n)\n\/\/ \u5168\u5c40\u53d8\u91cf m\nvar m = 100\nfunc main() {\nn := 10\nm := 200 \/\/ \u6b64\u5904\u58f0\u660e\u5c40\u90e8\u53d8\u91cf m\nfmt.Println(m, n)\n}\n\n\u4f7f\u7528\u53d8\u91cf\u4e00\u6b21\u58f0\u660e\u591a\u4e2a\u53d8\u91cf\uff0c\u5e76\u521d\u59cb\u5316\u53d8\u91cf\nm1, m2, m3 := 10, 20, 30\nfmt.Println(m1, m2, m3)\n\n7\u3001\u533f\u540d\u53d8\u91cf\n\u5728\u4f7f\u7528\u591a\u91cd\u8d4b\u503c\u65f6\uff0c\u5982\u679c\u60f3\u8981\u5ffd\u7565\u67d0\u4e2a\u503c\uff0c\u53ef\u4ee5\u4f7f\u7528\u533f\u540d\u53d8\u91cf\uff08anonymous variable\uff09\u3002\u533f\u540d\u53d8\u91cf\u7528\u4e00\u4e2a\u4e0b\u5212\u7ebf_\u8868\u793a\uff0c\u4f8b\u5982\uff1a\n\nfunc getInfo() (int, string) {\nreturn 10, \"\u5f20\u4e09\"\n}\n\nfunc main() { _, username := getInfo()\nfmt.Println(username)\n}\n\u533f\u540d\u53d8\u91cf\u4e0d\u5360\u7528\u547d\u540d\u7a7a\u95f4\uff0c\u4e0d\u4f1a\u5206\u914d\u5185\u5b58\uff0c\u6240\u4ee5\u533f\u540d\u53d8\u91cf\u4e4b\u95f4\u4e0d\u5b58\u5728\u91cd\u590d\u58f0\u660e\u3002\u6ce8\u610f\u4e8b\u9879\uff1a\n1\u3001\u51fd\u6570\u5916\u7684\u6bcf\u4e2a\u8bed\u53e5\u90fd\u5fc5\u987b\u4ee5\u5173\u952e\u5b57\u5f00\u59cb\uff08var\u3001const\u3001func \u7b49\uff09\n2\u3001:=\u4e0d\u80fd\u4f7f\u7528\u5728\u51fd\u6570\u5916\u3002\n3\u3001_\u591a\u7528\u4e8e\u5360\u4f4d\uff0c\u8868\u793a\u5ffd\u7565\u503c\u3002\n\n4\u3001Go \u8bed\u8a00\u4e2d\u7684\u5e38\u91cf\n\u76f8\u5bf9\u4e8e\u53d8\u91cf\uff0c\u5e38\u91cf\u662f\u6052\u5b9a\u4e0d\u53d8\u7684\u503c\uff0c\u591a\u7528\u4e8e\u5b9a\u4e49\u7a0b\u5e8f\u8fd0\u884c\u671f\u95f4\u4e0d\u4f1a\u6539\u53d8\u7684\u90a3\u4e9b\u503c\u3002\u5e38\u91cf\u7684\u58f0\u660e\u548c\u53d8\u91cf\u58f0\u660e\u975e\u5e38\u7c7b\u4f3c\uff0c\u53ea\u662f\u628a var \u6362\u6210\u4e86 const\uff0c\u5e38\u91cf\u5728\u5b9a\u4e49\u7684\u65f6\u5019\u5fc5\u987b\u8d4b\u503c\u3002\n\n1\u3001\u4f7f\u7528 const \u5b9a\u4e49\u5e38\u91cf\nconst pi = 3.1415\nconst e = 2.7182\n\n\u58f0\u660e\u4e86 pi \u548c e \u8fd9\u4e24\u4e2a\u5e38\u91cf\u4e4b\u540e\uff0c\u5728\u6574\u4e2a\u7a0b\u5e8f\u8fd0\u884c\u671f\u95f4\u5b83\u4eec\u7684\u503c\u90fd\u4e0d\u80fd\u518d\u53d1\u751f\u53d8\u5316\u4e86\u3002\u591a\u4e2a\u5e38\u91cf\u4e5f\u53ef\u4ee5\u4e00\u8d77\u58f0\u660e\uff1a\n\nconst (\npi = 3.1415\ne = 2.7182\n)\n\nconst \u540c\u65f6\u58f0\u660e\u591a\u4e2a\u5e38\u91cf\u65f6\uff0c\u5982\u679c\u7701\u7565\u4e86\u503c\u5219\u8868\u793a\u548c\u4e0a\u9762\u4e00\u884c\u7684\u503c\u76f8\u540c\u3002\u4f8b\u5982\uff1a\nconst (\nn1 = 100\nn2\nn3\n)\n\u4e0a\u9762\u793a\u4f8b\u4e2d\uff0c\u5e38\u91cf n1\u3001n2\u3001n3 \u7684\u503c\u90fd\u662f 100\u3002\n\n\u6253\u5370 Pi \u7684\u503c\npackage main\nimport ( \n\"fmt\"\n\"math\"\n)\nfunc main() {\nconst pi=math.Pi\nfmt.Println(pi);\n}\n\n\n2\u3001const \u5e38\u91cf\u7ed3\u5408 iota \u7684\u4f7f\u7528\uff08\u4e86\u89e3\uff09\niota \u662f golang \u8bed\u8a00\u7684\u5e38\u91cf\u8ba1\u6570\u5668,\u53ea\u80fd\u5728\u5e38\u91cf\u7684\u8868\u8fbe\u5f0f\u4e2d\u4f7f\u7528\u3002\niota \u5728 const \u5173\u952e\u5b57\u51fa\u73b0\u65f6\u5c06\u88ab\u91cd\u7f6e\u4e3a 0(const \u5185\u90e8\u7684\u7b2c\u4e00\u884c\u4e4b\u524d)\uff0cconst \u4e2d\u6bcf\u65b0\u589e\u4e00\u884c\u5e38\u91cf\u58f0\u660e\u5c06\u4f7f iota \u8ba1\u6570\u4e00\u6b21(iota \u53ef\u7406\u89e3\u4e3a const \u8bed\u53e5\u5757\u4e2d\u7684\u884c\u7d22\u5f15)\u3002\n\n1\u3001iota \u53ea\u80fd\u5728\u5e38\u91cf\u7684\u8868\u8fbe\u5f0f\u4e2d\u4f7f\u7528\u3002\nfmt.Println(iota)\n\u7f16\u8bd1\u9519\u8bef\uff1a undefined: iota\n\n\n2\u3001\u6bcf\u6b21 const \u51fa\u73b0\u65f6\uff0c\u90fd\u4f1a\u8ba9 iota \u521d\u59cb\u5316\u4e3a 0.\u3010\u81ea\u589e\u957f\u3011\nconst a = iota \/\/ a=0\nconst (\nb = iota \/\/b=0\nc \/\/c=1\n)\n\n3\u3001const iota \u4f7f\u7528_\u8df3\u8fc7\u67d0\u4e9b\u503c\nconst (\nn1 = iota \/\/0\nn2 \/\/1\n_n4 \/\/3\n)\n\n4\u3001iota \u58f0\u660e\u4e2d\u95f4\u63d2\u961f\nconst (\nn1 = iota \/\/0\nn2 = 100 \/\/100\nn3 = iota \/\/2\nn4 \/\/3\n)\nconst n5 = iota \/\/0\n\n\n4\u3001\u591a\u4e2a iota \u5b9a\u4e49\u5728\u4e00\u884c\nconst (\na, b = iota + 1, iota + 2 \/\/1,2\nc, d \/\/2,3\ne, f \/\/3,4\n)\n\n\n\n5\u3001Go \u8bed\u8a00\u53d8\u91cf\u3001\u5e38\u91cf\u547d\u540d\u89c4\u5219\n\n1\u3001\u53d8\u91cf\u540d\u79f0\u5fc5\u987b\u7531\u6570\u5b57\u3001\u5b57\u6bcd\u3001\u4e0b\u5212\u7ebf\u7ec4\u6210\u3002\n2\u3001\u6807\u8bc6\u7b26\u5f00\u5934\u4e0d\u80fd\u662f\u6570\u5b57\n3\u3001\u6807\u8bc6\u7b26\u4e0d\u80fd\u662f\u4fdd\u7559\u5b57\u548c\u5173\u952e\u5b57\u3002\n4\u3001\u53d8\u91cf\u7684\u540d\u5b57\u662f\u533a\u5206\u5927\u5c0f\u5199\u7684\u5982: age \u548c Age \u662f\u4e0d\u540c\u7684\u53d8\u91cf\u3002\u5728\u5b9e\u9645\u7684\u8fd0\u7528\u4e2d,\u4e5f\u5efa\u8bae,\u4e0d\u8981\u7528\u4e00\u4e2a\u5355\u8bcd\u5927\u5c0f\u5199\u533a\u5206\u4e24\u4e2a\u53d8\u91cf\u3002\n5\u3001\u6807\u8bc6\u7b26(\u53d8\u91cf\u540d\u79f0)\u4e00\u5b9a\u8981\u89c1\u540d\u601d\u610f \uff1a\u53d8\u91cf\u540d\u79f0\u5efa\u8bae\u7528\u540d\u8bcd\uff0c\u65b9\u6cd5\u540d\u79f0\u5efa\u8bae\u7528\u52a8\u8bcd\n6\u3001\u53d8\u91cf\u547d\u540d\u4e00\u822c\u91c7\u7528\u9a7c\u5cf0\u5f0f\uff0c\u5f53\u9047\u5230\u7279\u6709\u540d\u8bcd\uff08\u7f29\u5199\u6216\u7b80\u79f0\uff0c\u5982 DNS\uff09\u7684\u65f6\u5019\uff0c\u7279\u6709\u540d\u8bcd\u6839\u636e\u662f\u5426\u79c1\u6709\u5168\u90e8\u5927\u5199\u6216\u5c0f\u5199\u3002\n\n6\u3001Go \u8bed\u8a00\u4ee3\u7801\u98ce\u683c\n1\u3001\u4ee3\u7801\u6bcf\u4e00\u884c\u7ed3\u675f\u540e\u4e0d\u7528\u5199\u5206\u53f7\uff08 ;\uff09\n2\u3001\u8fd0\u7b97\u7b26\u5de6\u53f3\u5efa\u8bae\u5404\u52a0\u4e00\u4e2a\u7a7a\u683c\nvar username string = \"itying\" \n3\u3001Go \u8bed\u8a00\u7a0b\u5e8f\u5458\u63a8\u8350\u4f7f\u7528\u9a7c\u5cf0\u5f0f\u547d\u540d\n\u5f53\u540d\u5b57\u6709\u51e0\u4e2a\u5355\u8bcd\u7ec4\u6210\u7684\u65f6\u4f18\u5148\u4f7f\u7528\u5927\u5c0f\u5199\u5206\u9694\n4\u3001\u5f3a\u5236\u7684\u4ee3\u7801\u98ce\u683c\n\u5de6\u62ec\u53f7\u5fc5\u987b\u7d27\u63a5\u7740\u8bed\u53e5\u4e0d\u6362\u884c\uff0c\u8fd9\u4e2a\u7279\u6027\u521a\u5f00\u59cb\u4f1a\u4f7f\u5f00\u53d1\u8005\u4e0d\u4e60\u60ef\uff0c\u4f46\u968f\u7740\u5bf9Go \u8bed\u8a00\u7684\u4e0d\u65ad\u719f\u6089\uff0c\u5c31\u4f1a\u53d1\u73b0\u98ce\u683c\u7edf\u4e00\u8ba9\u5927\u5bb6\u5728\u9605\u8bfb\u4ee3\u7801\u65f6\u628a\u6ce8\u610f\u529b\u96c6\u4e2d\u5230\u4e86\u89e3\u51b3\u95ee\u9898\u4e0a\uff0c\u800c\u4e0d\u662f\u4ee3\u7801\u98ce\u683c\u4e0a\n5\u3001go fmt \u4e3b\u8981\u7528\u4e8e\u683c\u5f0f\u5316\u6587\u6863\uff0c\u8ba9\u6240\u6709\u4eba\u7684\u4ee3\u7801\u98ce\u683c\u4fdd\u6301\u4e00\u81f4\nD:\\golang\\src\\demo01>go fmt main.go\nmain.go<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Go\u8bed\u8a00\u5b9a\u4e49\u53d8\u91cf\u3001fmt\u5305\u3001Print\u3001Println\u3001Printf\u3001Go\u8bed\u8a00\u6ce8\u91ca Go \u53d8\u91cf\u3001\u5e38\u91cf\u3001\u53d8\u91cf\u547d\u540d\u89c4\u5219<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[24],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/posts\/1273"}],"collection":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/comments?post=1273"}],"version-history":[{"count":14,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/posts\/1273\/revisions"}],"predecessor-version":[{"id":1287,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/posts\/1273\/revisions\/1287"}],"wp:attachment":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/media?parent=1273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/categories?post=1273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/tags?post=1273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}