{"id":207819,"date":"2025-07-08T08:36:40","date_gmt":"2025-07-08T00:36:40","guid":{"rendered":"https:\/\/server.hk\/cnblog\/207819\/"},"modified":"2025-07-08T08:36:40","modified_gmt":"2025-07-08T00:36:40","slug":"godoc-%e7%b1%bb%e5%9e%8b-%e7%bb%93%e6%9e%84%e5%87%bd%e6%95%b0%e7%9a%84%e7%a4%ba%e4%be%8b%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/207819\/","title":{"rendered":"GoDoc \u7c7b\u578b\/\u7ed3\u6784\u51fd\u6570\u7684\u793a\u4f8b\u51fd\u6570"},"content":{"rendered":"<p><b><\/b> <\/p>\n<p>\u5f53\u524d\u4f4d\u7f6e\uff1a <span>&gt;<\/span> <span>&gt;<\/span> <span>&gt;<\/span> <span>&gt;<\/span> <span>GoDoc \u7c7b\u578b\/\u7ed3\u6784\u51fd\u6570\u7684\u793a\u4f8b\u51fd\u6570<\/span><\/p>\n<p><span>\u6765\u6e90\uff1astackoverflow<\/span><br \/>\n<span>2024-04-25 20:30:39<\/span><br \/>\n<span><i><\/i>0\u6d4f\u89c8<\/span><br \/>\n<span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>\u4e00\u5206\u8015\u8018\uff0c\u4e00\u5206\u6536\u83b7\uff01\u65e2\u7136\u6253\u5f00\u4e86\u8fd9\u7bc7\u6587\u7ae0<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aGoDoc \u7c7b\u578b\/\u7ed3\u6784\u51fd\u6570\u7684\u793a\u4f8b\u51fd\u6570\u300b<\/span>\uff0c\u5c31\u575a\u6301\u770b\u4e0b\u53bb\u5427\uff01\u6587\u4e2d\u5185\u5bb9\u5305\u542b<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9&#8230;\u5e0c\u671b\u4f60\u80fd\u5728\u9605\u8bfb\u672c\u6587\u540e\uff0c\u80fd\u771f\u771f\u5b9e\u5b9e\u5b66\u5230\u77e5\u8bc6\u6216\u8005\u5e2e\u4f60\u89e3\u51b3\u5fc3\u4e2d\u7684\u7591\u60d1\uff0c\u4e5f\u6b22\u8fce\u5927\u4f6c\u6216\u8005\u65b0\u4eba\u670b\u53cb\u4eec\u591a\u7559\u8a00\u8bc4\u8bba\uff0c\u591a\u7ed9\u5efa\u8bae\uff01\u8c22\u8c22\uff01<\/p>\n<p> \u95ee\u9898\u5185\u5bb9<br \/>\n <\/p>\n<h1>\u95ee\u9898<\/h1>\n<p>\u6211\u7f16\u5199\u4e86\u4e00\u4e9b\u4f4d\u4e8e *_test.go \u6587\u4ef6\u4e2d\u7684\u793a\u4f8b\u51fd\u6570\uff0c\u4ee5\u5e2e\u52a9\u6f84\u6e05\u72ec\u7acb\u516c\u5171\u51fd\u6570\u7684\u4e0a\u4e0b\u6587\uff0c\u800c\u4e0d\u4f1a\u51fa\u73b0\u95ee\u9898\u3002\u5f53\u4e3a\u4e0e\u7c7b\u578b\u76f8\u5173\u7684\u51fd\u6570\u7f16\u5199\u793a\u4f8b\u51fd\u6570\u65f6\uff0c\u5c31\u4f1a\u51fa\u73b0\u663e\u793a\u95ee\u9898\u3002<\/p>\n<h1>\u793a\u4f8b<\/h1>\n<p>\u8fd9\u662f\u6211\u9047\u5230\u7684\u4e00\u4e2a\u57fa\u672c\u793a\u4f8b\u3002<\/p>\n<p>\u5047\u8bbe\u6211\u4eec\u5728 main.go \u4e2d\u6709\u4e00\u4e2a\u51fd\u6570\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>type client struct {\n  user string\n  ip string\n}\n\nfunc (c *client) sendnotification(message string) error {\n  return nil\n}<\/pre>\n<p>\u6211\u60f3\u5728 main_test.go \u4e2d\u521b\u5efa\u4e00\u4e2a\u793a\u4f8b\u51fd\u6570\uff0c\u5982\u4e0b\u6240\u793a<\/p>\n<pre>func examplesendnotification() {\n  \/\/showoff code here\n}<\/pre>\n<p>vscode \u9488\u5bf9\u8be5\u7279\u5b9a\u793a\u4f8b\u5f15\u53d1\u9519\u8bef\uff0c\u6307\u51fa\u201cexamplesendnotification \u5f15\u7528\u672a\u77e5\u6807\u8bc6\u7b26\uff1asendnotification\u201d\u3002\u53e6\u5916\uff0c\u8fd0\u884c godoc \u65f6\u5b83\u4e0d\u4f1a\u4f5c\u4e3a\u793a\u4f8b\u51fa\u73b0\u3002<\/p>\n<p>\u6211\u4e5f\u5c1d\u8bd5\u8fc7\u8fd9\u79cd\u683c\u5f0f\uff1a<\/p>\n<pre>func (c *Client) ExampleSendNotification() {\n  \/\/Showoff code here\n}<\/pre>\n<p>\u4f46\u968f\u540e\u5b83\u53ea\u662f\u5c06\u5176\u4f5c\u4e3a vscode \u4e2d\u7684\u6d4b\u8bd5\u5220\u9664\uff0c\u5e76\u4e14\u6ca1\u6709\u51fa\u73b0<\/p>\n<p> <\/p>\n<h2>\u6b63\u786e\u7b54\u6848<\/h2>\n<p> <\/p>\n<p>\u6211\u5728\u5199\u5b8c\u8fd9\u7bc7\u6587\u7ae0\u65f6\u627e\u5230\u4e86\u7b54\u6848\u3002\u6211\u60f3\u6211\u4ecd\u7136\u4f1a\u4e3a\u5176\u4ed6\u4eba\u53d1\u5e16\u3002<\/p>\n<p>\u8bc0\u7a8d\u662f\u7f16\u5199\u793a\u4f8b[\u7c7b\u578b]_[\u65b9\u6cd5]\uff0c\u56e0\u6b64\u5b9e\u9645\u4e0a\u5728\u6211\u7684\u793a\u4f8b\u4e2d\uff0c\u5b83\u770b\u8d77\u6765\u50cf\uff1a<\/p>\n<pre>func ExampleClient_SendNotification() {\n  \/\/Showoff code here\n}<\/pre>\n<p>\u7ec8\u4e8e\u4ecb\u7ecd\u5b8c\u5566\uff01\u5c0f\u4f19\u4f34\u4eec\uff0c\u8fd9\u7bc7\u5173\u4e8e\u300aGoDoc \u7c7b\u578b\/\u7ed3\u6784\u51fd\u6570\u7684\u793a\u4f8b\u51fd\u6570\u300b\u7684\u4ecb\u7ecd\u5e94\u8be5\u8ba9\u4f60\u6536\u83b7\u591a\u591a\u4e86\u5427\uff01\u6b22\u8fce\u5927\u5bb6\u6536\u85cf\u6216\u5206\u4eab\u7ed9\u66f4\u591a\u9700\u8981\u5b66\u4e60\u7684\u670b\u53cb\u5427~\u516c\u4f17\u53f7\u4e5f\u4f1a\u53d1\u5e03Golang\u76f8\u5173\u77e5\u8bc6\uff0c\u5feb\u6765\u5173\u6ce8\u5427\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u524d\u4f4d\u7f6e\uff1a &gt; &gt; &#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-207819","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/207819","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=207819"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/207819\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=207819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=207819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=207819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}