{"id":556260,"date":"2022-03-04T20:24:36","date_gmt":"2022-03-04T12:24:36","guid":{"rendered":"http:\/\/4563.org\/?p=556260"},"modified":"2022-03-04T20:24:36","modified_gmt":"2022-03-04T12:24:36","slug":"%e8%af%b7%e9%97%ae-go-%e7%9a%84%e5%8f%8d%e5%b0%84-%e6%98%af%e4%b8%8d%e6%98%af%e5%bf%85%e9%a1%bb%e8%a6%81%e5%85%88%e6%9c%89%e4%b8%80%e4%b8%aa%e6%98%8e%e7%a1%ae%e7%9a%84%e7%bb%93%e6%9e%84%e4%bd%93-6","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=556260","title":{"rendered":"\u8bf7\u95ee go \u7684\u53cd\u5c04 \u662f\u4e0d\u662f\u5fc5\u987b\u8981\u5148\u6709\u4e00\u4e2a\u660e\u786e\u7684\u7ed3\u6784\u4f53\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1> \u8bf7\u95ee go \u7684\u53cd\u5c04 \u662f\u4e0d\u662f\u5fc5\u987b\u8981\u5148\u6709\u4e00\u4e2a\u660e\u786e\u7684\u7ed3\u6784\u4f53\uff1f <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Joker123456789 <\/span>  <span><i><\/i> 24<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4eca\u5929\u770b\u5230 go \u53cd\u5c04\u7684\u65f6\u5019\uff0c\u53d1\u73b0 \u6240\u6709\u7684\u4f8b\u5b50\u90fd\u662f\u8fd9\u6837\u7684<\/p>\n<h3>\u9996\u5148\u8981\u6709\u4e00\u4e2a\u7ed3\u6784\u4f53<\/h3>\n<pre><code>type  Demo struts {  }  func (demo Demo) CallFuncNoArgs (){  } <\/code><\/pre>\n<h3>\u7136\u540e\u624d\u53ef\u4ee5\u7528\u53cd\u5c04<\/h3>\n<pre><code>var demo= &amp;Demo {}  reflect.ValueOf(demo).MethodByName(\"CallFuncNoArgs\").Call([]reflect.Value{}) <\/code><\/pre>\n<p>\u53d1\u73b0\u8fd9\u6837\u9650\u5236\u975e\u5e38\u5927\uff0c\u5982\u679c \u6211\u60f3\u7528\u53cd\u5c04 \u8c03\u7528\u4efb\u610f\u51fd\u6570\uff0c\u600e\u4e48\u529e\uff1f \u6bd4\u5982<\/p>\n<h3>\u6709\u8fd9\u6837\u4e00\u4e2a\u5b57\u7b26\u4e32<\/h3>\n<pre><code>var fucnName = \"api.getList\" <\/code><\/pre>\n<p>api \u662f \u5305\u540d\uff0cgetList \u662f\u51fd\u6570\u540d<\/p>\n<p>\u8fd9\u79cd\u60c5\u51b5\uff0c\u6211\u60f3\u901a\u8fc7\u8fd9\u4e2a\u5b57\u7b26\u4e32 \u6267\u884c\u5bf9\u5e94\u7684\u51fd\u6570\uff0c\u8be5\u600e\u4e48\u64cd\u4f5c\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>8<\/span>) <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"7151512\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : sun522198558 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> &#8220;`go<br \/>registry := map[string]func() interface{}{<br \/> &#8220;Demo&#8221;: func() interface{} { return Demo{} },<br \/>}<br \/>reflect.ValueOf(registry[&#8220;Demo&#8221;]()).MethodByName(&#8220;CallFuncNoArgs&#8221;).Call(nil)<br \/>&#8220;` <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7151513\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Joker123456789 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @sun522198558 <br \/>\u975e\u5e38\u611f\u8c22\u4f60\u7684\u89e3\u7b54\uff0c<br \/>\u4f46\u662f\u6211\u770b\u4e86\u4e00\u4e0b\uff0c\u53d1\u73b0\u8fd9\u79cd\u65b9\u5f0f \u53ea\u662f\u628a [var demo= &amp;Demo {}] \u8fd9\u53e5\u590d\u6742\u5316\u4e86\u4e00\u4e0b\uff0c\u6211\u662f\u76f4\u63a5\u5b9a\u4e49\u7684\uff0c\u4f60\u662f\u5b9a\u4e49\u540e\u653e\u5165 map \uff0c\u7136\u540e\u4ece map \u53d6\uff0c\u6ca1\u6709\u4ece\u6839\u672c\u4e0a\u89e3\u51b3\u95ee\u9898\u3002<br \/>\u4e0d\u8fc7\u6211\u8fd8\u662f\u975e\u5e38\u611f\u8c22\u4f60\uff0c\u8c22\u8c22\u3002 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7151514\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : keepeye <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> go \u5e76\u6ca1\u6709\u5185\u7f6e\u5b58\u50a8\u5305\u3001\u51fd\u6570\u7684\u5168\u5c40 map \uff0c\u4f60\u5fc5\u987b\u81ea\u5df1\u5b9a\u4e49\u4e00\u4e2a map \uff0c\u628a\u4f60\u90a3\u4e9b\u51fd\u6570\u90fd\u5b58\u5230 map \u91cc\u9762\u518d\u914d\u5408 reflect \u8c03\u7528\u3002\u3002 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7151515\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Joker123456789 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @keepeye \u989d\uff0c\u597d\u5427\uff0c\u8c22\u8c22 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7151516\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : bankroft <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u8003\u8651\u4e00\u4e0b\u7528 plugin <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7151517\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : fgwmlhdkkkw <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> go \u7f16\u8bd1\u5b8c\u662f exe \uff0c\u4e0d\u80fd\u52a8\u6001\u52a0\u8f7d class\u2026\u2026 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7151518\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Buges <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> go \u7684\u8fd0\u884c\u65f6\u6ca1\u6709\u5143\u6570\u636e\u3002<br \/>\u4f60\u8bf4\u7684\u90a3\u79cd\u5b57\u7b26\u4e32\u52a8\u6001\u8c03\u7528\u5f97\u6709\u5143\u6570\u636e\u624d\u80fd\u5b9e\u73b0\uff0c\u4e00\u822c\u8fd9\u6837\u7684\u8bed\u8a00\uff08 Java \u3001c#\u7b49\uff09\u975e\u5e38\u5bb9\u6613\u53cd\u7f16\u8bd1\u5c31\u662f\u56e0\u4e3a\u5143\u6570\u636e\u7684\u539f\u56e0\u3002 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7151519\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : liuhan907 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @Buges Go \u6709\u5143\u6570\u636e\uff0c\u53ea\u662f\u4e0d\u516c\u5f00\u7ed9\u5f00\u53d1\u8005\u800c\u5df2\u3002 <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf7\u95ee go \u7684\u53cd\u5c04 \u662f\u4e0d\u662f\u5fc5\u987b\u8981\u5148&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/556260"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=556260"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/556260\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=556260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=556260"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=556260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}