{"id":3692,"date":"2022-12-30T13:34:02","date_gmt":"2022-12-30T05:34:02","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=3692"},"modified":"2022-12-30T13:34:02","modified_gmt":"2022-12-30T05:34:02","slug":"%e5%ad%b8%e7%bf%92go%e8%aa%9e%e8%a8%80%e4%b8%ad%e7%9a%84%e7%b5%90%e6%a7%8b%e4%bd%93","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/go\/%e5%ad%b8%e7%bf%92go%e8%aa%9e%e8%a8%80%e4%b8%ad%e7%9a%84%e7%b5%90%e6%a7%8b%e4%bd%93\/","title":{"rendered":"\u5b78\u7fd2Go\u8a9e\u8a00\u4e2d\u7684\u7d50\u69cb\u4f53"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"Go, \u7d50\u69cb\u4f53\"><\/p>\n<p>Go \u8a9e\u8a00\u7684\u7d50\u69cb\u4f53\u662f\u4e00\u500b\u975e\u5e38\u6709\u7528\u7684\u6982\u5ff5\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u8f49\u63db\u70ba\u66f4\u5bb9\u6613\u7406\u89e3\u7684\u5f62\u5f0f\u3002\u7d50\u69cb\u4f53\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u8f49\u63db\u70ba\u66f4\u5bb9\u6613\u7406\u89e3\u7684\u5f62\u5f0f\uff0c\u4e26\u4e14\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u5c0d\u8cc7\u6599\u9032\u884c\u64cd\u4f5c\u3002<!--more--><\/p>\n<p>Go \u8a9e\u8a00\u7684\u7d50\u69cb\u4f53\u662f\u4e00\u500b\u975e\u5e38\u6709\u7528\u7684\u6982\u5ff5\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u8f49\u63db\u70ba\u66f4\u5bb9\u6613\u7406\u89e3\u7684\u5f62\u5f0f\u3002\u7d50\u69cb\u4f53\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u8f49\u63db\u70ba\u66f4\u5bb9\u6613\u7406\u89e3\u7684\u5f62\u5f0f\uff0c\u4e26\u4e14\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u5c0d\u8cc7\u6599\u9032\u884c\u64cd\u4f5c\u3002<\/p>\n<h2>Go \u8a9e\u8a00\u7684\u7d50\u69cb\u4f53<\/h2>\n<p>Go \u8a9e\u8a00\u7684\u7d50\u69cb\u4f53\u662f\u4e00\u7a2e\u8cc7\u6599\u7d50\u69cb\uff0c\u5b83\u53ef\u4ee5\u5c07\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u8f49\u63db\u70ba\u66f4\u5bb9\u6613\u7406\u89e3\u7684\u5f62\u5f0f\u3002\u7d50\u69cb\u4f53\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u8f49\u63db\u70ba\u66f4\u5bb9\u6613\u7406\u89e3\u7684\u5f62\u5f0f\uff0c\u4e26\u4e14\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u5c0d\u8cc7\u6599\u9032\u884c\u64cd\u4f5c\u3002<\/p>\n<p>Go \u8a9e\u8a00\u7684\u7d50\u69cb\u4f53\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u8f49\u63db\u70ba\u66f4\u5bb9\u6613\u7406\u89e3\u7684\u5f62\u5f0f\uff0c\u4e26\u4e14\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u5c0d\u8cc7\u6599\u9032\u884c\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u7d50\u69cb\u4f53\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u8f49\u63db\u70ba\u66f4\u5bb9\u6613\u7406\u89e3\u7684\u5f62\u5f0f\uff0c\u4e26\u4e14\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u5c0d\u8cc7\u6599\u9032\u884c\u64cd\u4f5c\u3002<\/p>\n<pre class=\"brush: go\">\ntype Person struct {\n    Name string\n    Age int\n}\n\nfunc main() {\n    p := Person{\n        Name: \"John\",\n        Age:  20,\n    }\n    fmt.Println(p)\n}\n<\/pre>\n<p>\u4e0a\u9762\u7684\u7a0b\u5f0f\u78bc\u793a\u7bc4\u4e86\u5982\u4f55\u4f7f\u7528 Go \u8a9e\u8a00\u7684\u7d50\u69cb\u4f53\u4f86\u5b9a\u7fa9\u4e00\u500b Person \u7d50\u69cb\u4f53\uff0c\u4e26\u4e14\u5c07\u4e00\u500b Person \u7269\u4ef6\u8ce6\u503c\u7d66 p \u8b8a\u6578\u3002<\/p>\n<p>Go \u8a9e\u8a00\u7684\u7d50\u69cb\u4f53\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u8f49\u63db\u70ba\u66f4\u5bb9\u6613\u7406\u89e3\u7684\u5f62\u5f0f\uff0c\u4e26\u4e14\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u5c0d\u8cc7\u6599\u9032\u884c\u64cd\u4f5c\u3002Go \u8a9e\u8a00\u7684\u7d50\u69cb\u4f53\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u8f49\u63db\u70ba\u66f4\u5bb9\u6613\u7406\u89e3\u7684\u5f62\u5f0f\uff0c\u4e26\u4e14\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u5c0d\u8cc7\u6599\u9032\u884c\u64cd\u4f5c\u3002<\/p>\n<p>Go \u8a9e\u8a00\u7684\u7d50\u69cb\u4f53\u662f\u4e00\u500b\u975e\u5e38\u6709\u7528\u7684\u6982\u5ff5\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u8f49\u63db\u70ba\u66f4\u5bb9\u6613\u7406\u89e3\u7684\u5f62\u5f0f\uff0c\u4e26\u4e14\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u5c0d\u8cc7\u6599\u9032\u884c\u64cd\u4f5c\u3002Go \u8a9e\u8a00\u7684\u7d50\u69cb\u4f53\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u8f49\u63db\u70ba\u66f4\u5bb9\u6613\u7406\u89e3\u7684\u5f62\u5f0f\uff0c\u4e26\u4e14\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u5c0d\u8cc7\u6599\u9032\u884c\u64cd\u4f5c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Go\u8a9e\u8a00\u4e2d\u7684\u7d50\u69cb\u4f53\u662f\u4e00\u7a2e\u5c01\u88dd\u8cc7\u6599\u7684\u65b9\u5f0f\uff0c\u53ef\u4ee5\u5c07\u8cc7\u6599\u7d50\u69cb\u5316\uff0c\u66f4\u5bb9\u6613\u7ba1\u7406\u548c\u7dad\u8b77\uff0c\u672c\u6587\u5c07\u4ecb\u7d39Go\u8a9e\u8a00\u4e2d\u7684\u7d50\u69cb\u4f53\u7684\u57fa\u672c\u6982\u5ff5\u3001\u5b9a\u7fa9\u65b9\u5f0f\u3001\u5c6c\u6027\u548c\u65b9\u6cd5\u7b49\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[171,172],"tags":[169,170],"class_list":["post-3692","post","type-post","status-publish","format-standard","hentry","category-go","category-golang","tag-go","tag-golang"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcFK27-Xy","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/3692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/comments?post=3692"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/3692\/revisions"}],"predecessor-version":[{"id":3693,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/3692\/revisions\/3693"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=3692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=3692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=3692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}