{"id":3768,"date":"2022-12-30T14:18:20","date_gmt":"2022-12-30T06:18:20","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=3768"},"modified":"2022-12-30T14:18:20","modified_gmt":"2022-12-30T06:18:20","slug":"%e6%b7%b1%e5%85%a5%e6%8e%a2%e7%b4%a2go%e8%aa%9e%e8%a8%80%e4%b8%ad%e7%9a%84%e9%a1%9e%e5%9e%8b%e5%b5%8c%e5%a5%97","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/go\/%e6%b7%b1%e5%85%a5%e6%8e%a2%e7%b4%a2go%e8%aa%9e%e8%a8%80%e4%b8%ad%e7%9a%84%e9%a1%9e%e5%9e%8b%e5%b5%8c%e5%a5%97\/","title":{"rendered":"\u6df1\u5165\u63a2\u7d22Go\u8a9e\u8a00\u4e2d\u7684\u985e\u578b\u5d4c\u5957"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"Go, \u985e\u578b\u5d4c\u5957, \u7a0b\u5f0f\u7bc4\u4f8b\"><\/p>\n<p>Go \u8a9e\u8a00\u7684\u985e\u578b\u5d4c\u5957\u662f\u4e00\u500b\u975e\u5e38\u6709\u8da3\u7684\u6982\u5ff5\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u4e0d\u540c\u985e\u578b\u7684\u8cc7\u6599\u7d50\u69cb\u7d44\u5408\u5728\u4e00\u8d77\uff0c\u4ee5\u69cb\u5efa\u66f4\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u5c07\u8a73\u7d30\u4ecb\u7d39 Go \u8a9e\u8a00\u4e2d\u7684\u985e\u578b\u5d4c\u5957\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u7a0b\u5f0f\u7bc4\u4f8b\u4f86\u8aaa\u660e\u5982\u4f55\u4f7f\u7528\u5b83\u3002<\/p>\n<h2>\u4ec0\u9ebc\u662f\u985e\u578b\u5d4c\u5957\uff1f<\/h2>\n<p>\u985e\u578b\u5d4c\u5957\u662f\u6307\u5c07\u4e00\u500b\u985e\u578b\u7684\u8cc7\u6599\u7d50\u69cb\u5305\u542b\u5728\u53e6\u4e00\u500b\u985e\u578b\u7684\u8cc7\u6599\u7d50\u69cb\u4e2d\u3002\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u4e0d\u540c\u985e\u578b\u7684\u8cc7\u6599\u7d50\u69cb\u7d44\u5408\u5728\u4e00\u8d77\uff0c\u4ee5\u69cb\u5efa\u66f4\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u3002<\/p>\n<p><!--more--><\/p>\n<h2>Go \u8a9e\u8a00\u4e2d\u7684\u985e\u578b\u5d4c\u5957<\/h2>\n<p>Go \u8a9e\u8a00\u4e2d\u7684\u985e\u578b\u5d4c\u5957\u662f\u4e00\u7a2e\u975e\u5e38\u6709\u7528\u7684\u6280\u8853\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u4e0d\u540c\u985e\u578b\u7684\u8cc7\u6599\u7d50\u69cb\u7d44\u5408\u5728\u4e00\u8d77\uff0c\u4ee5\u69cb\u5efa\u66f4\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u3002<\/p>\n<p>Go \u8a9e\u8a00\u4e2d\u7684\u985e\u578b\u5d4c\u5957\u53ef\u4ee5\u4f7f\u7528 struct \u95dc\u9375\u5b57\u4f86\u5be6\u73fe\uff0c\u4e0b\u9762\u662f\u4e00\u500b\u7c21\u55ae\u7684\u793a\u4f8b\uff1a<\/p>\n<pre class=\"brush: go\">\ntype Person struct {\n    Name string\n    Age int\n    Address Address\n}\n\ntype Address struct {\n    City string\n    State string\n}\n<\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u5011\u5b9a\u7fa9\u4e86\u4e00\u500b Person \u985e\u578b\uff0c\u5b83\u5305\u542b\u4e86\u4e00\u500b Name \u5b57\u6bb5\uff0c\u4e00\u500b Age \u5b57\u6bb5\uff0c\u4ee5\u53ca\u4e00\u500b Address \u5b57\u6bb5\u3002Address \u5b57\u6bb5\u662f\u4e00\u500b Address \u985e\u578b\uff0c\u5b83\u5305\u542b\u4e86\u4e00\u500b City \u5b57\u6bb5\u548c\u4e00\u500b State \u5b57\u6bb5\u3002<\/p>\n<p>\u901a\u904e\u4f7f\u7528\u985e\u578b\u5d4c\u5957\uff0c\u6211\u5011\u53ef\u4ee5\u5c07\u4e0d\u540c\u985e\u578b\u7684\u8cc7\u6599\u7d50\u69cb\u7d44\u5408\u5728\u4e00\u8d77\uff0c\u4ee5\u69cb\u5efa\u66f4\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u3002<\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u8a73\u7d30\u4ecb\u7d39\u4e86 Go \u8a9e\u8a00\u4e2d\u7684\u985e\u578b\u5d4c\u5957\uff0c\u4e26\u63d0\u4f9b\u4e86\u4e00\u4e9b\u7a0b\u5f0f\u7bc4\u4f8b\u4f86\u8aaa\u660e\u5982\u4f55\u4f7f\u7528\u5b83\u3002\u985e\u578b\u5d4c\u5957\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u4e0d\u540c\u985e\u578b\u7684\u8cc7\u6599\u7d50\u69cb\u7d44\u5408\u5728\u4e00\u8d77\uff0c\u4ee5\u69cb\u5efa\u66f4\u8907\u96dc\u7684\u8cc7\u6599\u7d50\u69cb\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0eGo\u8a9e\u8a00\u4e2d\u7684\u985e\u578b\u5d4c\u5957\uff0c\u8a73\u7d30\u4ecb\u7d39\u5176\u57fa\u672c\u6982\u5ff5\u3001\u512a\u9ede\u3001\u7f3a\u9ede\u53ca\u61c9\u7528\u7b49\uff0c\u8b93\u8b80\u8005\u80fd\u5920\u66f4\u52a0\u6df1\u5165\u4e86\u89e3Go\u8a9e\u8a00\u4e2d\u7684\u985e\u578b\u5d4c\u5957\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-3768","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-YM","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/3768","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=3768"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/3768\/revisions"}],"predecessor-version":[{"id":3769,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/3768\/revisions\/3769"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=3768"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=3768"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=3768"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}