{"id":3402,"date":"2021-05-22T13:59:34","date_gmt":"2021-05-22T05:59:34","guid":{"rendered":"http:\/\/blog.ywdevops.cn\/?p=3402"},"modified":"2025-05-14T18:32:53","modified_gmt":"2025-05-14T10:32:53","slug":"interface","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2021\/05\/22\/interface\/","title":{"rendered":"Go\u8bed\u8a00\u4e4b\u63a5\u53e3(Interface)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u63a5\u53e3\u672c\u8eab\u662f\u8c03\u7528\u65b9\u548c\u5b9e\u73b0\u65b9\u5747\u9700\u8981\u9075\u5b88\u7684\u4e00\u79cd\u534f\u8bae\uff0c\u5927\u5bb6\u6309\u7167\u7edf\u4e00\u7684\u65b9\u6cd5\u547d\u540d\u53c2\u6570\u7c7b\u578b\u548c\u6570\u91cf\u6765\u534f\u8c03\u903b\u8f91\u5904\u7406\u7684\u8fc7\u7a0b\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Go \u8bed\u8a00\u4e2d\u4f7f\u7528\u7ec4\u5408\u5b9e\u73b0\u5bf9\u8c61\u7279\u6027\u7684\u63cf\u8ff0\u3002\u5bf9\u8c61\u7684\u5185\u90e8\u4f7f\u7528\u7ed3\u6784\u4f53\u5185\u5d4c\u7ec4\u5408\u5bf9\u8c61\u5e94\u8be5\u5177\u6709\u7684\u7279\u6027\uff0c\u5bf9\u5916\u901a\u8fc7\u63a5\u53e3\u66b4\u9732\u80fd\u4f7f\u7528\u7684\u7279\u6027\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Go \u8bed\u8a00\u7684\u63a5\u53e3\u8bbe\u8ba1\u662f\u975e\u4fb5\u5165\u5f0f\u7684\uff0c\u63a5\u53e3\u7f16\u5199\u8005\u65e0\u987b\u77e5\u9053\u63a5\u53e3\u88ab\u54ea\u4e9b\u7c7b\u578b\u5b9e\u73b0\uff0c\u800c\u63a5\u53e3\u5b9e\u73b0\u8005\u53ea\u9700\u77e5\u9053\u5b9e\u73b0\u7684\u662f\u4ec0\u4e48\u6837\u5b50\u7684\u63a5\u53e3\uff0c\u4f46\u65e0\u987b\u6307\u660e\u5b9e\u73b0\u54ea\u4e00\u4e2a\u63a5\u53e3\u3002\u7f16\u8bd1\u5668\u77e5\u9053\u6700\u7ec8\u7f16\u8bd1\u65f6\u4f7f\u7528\u54ea\u4e2a\u7c7b\u578b\u5b9e\u73b0\u54ea\u4e2a\u63a5\u53e3\uff0c\u6216\u8005\u63a5\u53e3\u5e94\u8be5\u7531\u8c01\u6765\u5b9e\u73b0\u3002<\/p>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u8bf7\u7262\u8bb0\u63a5\u53e3\uff08interface\uff09\u662f\u4e00\u79cd\u7c7b\u578b\uff0c\u4e00\u79cd\u62bd\u8c61\u7684\u7c7b\u578b\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Go\u8bed\u8a00\u4e2d\u63a5\u53e3\u7684\u4f5c\u7528\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u53ef\u4ee5\u4f5c\u4e3a\u51fd\u6570\u548c\u65b9\u6cd5\u7684\u53c2\u6570\u6216\u8005\u8fd4\u56de\u503c\u7684\u4f7f\u7528\uff0c\u53ef\u4ee5\u901a\u8fc7\u7c7b\u578b\u65ad\u8a00\u548cswitch\u65b9\u6cd5<\/li>\n\n\n\n<li>\u591a\u6001\u7684\u4f7f\u7528\uff0c\u5728\u7a0b\u5e8f\u8bbe\u8ba1\u4e2d\uff0c\u62bd\u8c61\u51fa\u67d0\u4e9b\u5bf9\u8c61\u5171\u540c\u62e5\u6709\u7684\u65b9\u6cd5\uff0c\u591a\u79cd\u7c7b\u578b\u5b9e\u73b0\u540c\u4e00\u63a5\u53e3\uff0c\u901a\u8fc7\u63a5\u53e3\u53d8\u91cf\u6307\u5411\u5177\u4f53\u5bf9\u8c61\u64cd\u4f5c\u8fd9\u4e9b\u65b9\u6cd5(\u5728\u9762\u5411\u5bf9\u8c61\u8bed\u8a00\u4e2d\uff0c\u63a5\u53e3\u7684\u591a\u79cd\u4e0d\u540c\u7684\u5b9e\u73b0\u65b9\u5f0f\u5373\u4e3a\u591a\u6001)<\/li>\n<\/ul>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>\u4e3a\u4ec0\u4e48\u8981\u4f7f\u7528\u63a5\u53e3\uff1f<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u4ee5\u652f\u4ed8\u63a5\u53e3\u4e3a\u4f8b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u4f8b\u5b50\u8868\u793a\u6ca1\u6709\u5b9a\u4e49\u63a5\u53e3\u7684\u65f6\u5019\uff0c\u5448\u73b0\u7684\u652f\u4ed8\u65b9\u5f0f\uff0c\u5fae\u4fe1\u548c\u548c\u652f\u4ed8\u5b9d\u90fd\u5177\u5907\u652f\u4ed8\u7684\u52a8\u4f5c\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"711\" height=\"414\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/1-3.png\" alt=\"\" class=\"wp-image-6869\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/1-3.png 711w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/1-3-300x175.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/1-3-600x349.png 600w\" sizes=\"auto, (max-width: 711px) 100vw, 711px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u56fe\u4e2d\u7684\u4ee3\u7801\u6267\u884c\u7ed3\u679c\u4f1a\u663e\u793a\u4e24\u4e2a\u652f\u4ed8\u6837\u5f0f\uff0c\u4e00\u4e2a\u662f\u652f\u4ed8\u5b9d\u652f\u4ed8\uff0c\u4e00\u4e2a\u662f\u5fae\u4fe1\u652f\u4ed8\uff0c\u65e2\u7136\u4ed6\u4eec\u90fd\u5177\u5907\u76f8\u540c\u7684\u652f\u4ed8\u52a8\u4f5c\uff0c\u90a3\u4e48\u662f\u5426\u53ef\u4ee5\u5c06\u652f\u4ed8\u7684\u65b9\u6cd5\u63d0\u70bc\u51fa\u6765\uff0c\u505a\u6210\u4e00\u4e2a\u63a5\u53e3\uff0c\u7136\u540e\u6839\u636e\u4f20\u5165\u7684\u5b9e\u73b0\u7c7b\u4e0d\u540c\uff0c\u53bb\u8c03\u7528\u4e0d\u540c\u7684\u652f\u4ed8\u65b9\u5f0f\uff0c\u6765\u5b9e\u73b0\u591a\u6001\u529f\u80fd\uff0c\u4fee\u6539\u540e\u7684\u5185\u5bb9\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"625\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/3-3.png\" alt=\"\" class=\"wp-image-6874\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/3-3.png 709w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/3-3-300x264.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/3-3-600x529.png 600w\" sizes=\"auto, (max-width: 709px) 100vw, 709px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u4e0a\u56fe\u4e2d\u53ef\u770b\u51fa\uff0c\u5b9a\u4e49\u4e86\u652f\u4ed8\u63a5\u53e3\uff0c\u4e24\u4e2a\u652f\u4ed8\u65b9\u5f0f\u5206\u522b\u5b9e\u73b0\u4e86\u6b64\u63a5\u53e3\uff0c\u901a\u8fc7\u51fd\u6570callpayment\u4f20\u9012\u7ed9\u63a5\u53e3\uff0c\u63a5\u53e3\u6839\u636e\u4f20\u9012\u5185\u5bb9\u7684\u4e0d\u540c\u6765\u8c03\u7528\u4e0d\u7528\u7684\u652f\u4ed8\u65b9\u5f0f\uff0c\u4ece\u800c\u5b9e\u73b0\u4e86\u591a\u6001(\u60f3\u8c61\u4e00\u4e0b\u4e00\u7801\u652f\u4ed8\u7684\u539f\u7406)<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>\u4e00\u3001\u58f0\u660e\u63a5\u53e3\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a5\u53e3\u662f\u53cc\u65b9\u7ea6\u5b9a\u7684\u4e00\u79cd\u5408\u4f5c\u534f\u8bae\u3002\u63a5\u53e3\u5b9e\u73b0\u8005\u4e0d\u9700\u8981\u5173\u5fc3\u63a5\u53e3\u4f1a\u88ab\u600e\u6837\u4f7f\u7528\uff0c\u8c03\u7528\u8005\u4e5f\u4e0d\u9700\u8981\u5173\u5fc3\u63a5\u53e3\u7684\u5b9e\u73b0\u7ec6\u8282\u3002\u63a5\u53e3\u662f\u4e00\u79cd\u7c7b\u578b\uff0c\u4e5f\u662f\u4e00\u79cd\u62bd\u8c61\u7ed3\u6784\uff0c\u4e0d\u4f1a\u66b4\u9732\u6240\u542b\u6570\u636e\u7684\u683c\u5f0f\u3001\u7c7b\u578b\u53ca\u7ed3\u6784\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1\u3001\u63a5\u53e3\u58f0\u660e\u683c\u5f0f\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6bcf\u4e2a\u63a5\u53e3\u7c7b\u578b\u7531\u6570\u4e2a\u65b9\u6cd5\u7ec4\u6210\u3002\u63a5\u53e3\u7684\u5f62\u5f0f\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>type \u63a5\u53e3\u7c7b\u578b\u540d interface{\n    \u65b9\u6cd5\u540d1 \uff08 \u53c2\u6570\u5217\u88681 \uff09\u8fd4\u56de\u503c\u5217\u8868l\n    \u65b9\u6cd5\u540d2 \uff08 \u53c2\u6570\u5217\u88682 \uff09\u8fd4\u56de\u503c\u5217\u88682\n    ....\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u63a5\u53e3\u7c7b\u578b\u540d\uff1a \u4f7f\u7528type \u5c06\u63a5\u53e3\u5b9a\u4e49\u4e3a\u81ea\u5b9a\u4e49\u7684\u7c7b\u578b\u540d\u3002Go \u8bed\u8a00\u7684\u63a5\u53e3\u5728\u547d\u540d\u65f6\uff0c\u4e00\u822c\u4f1a\u5728\u5355\u8bcd\u540e\u9762\u6dfb\u52a0er \uff0c\u5982\u6709\u5199\u64cd\u4f5c\u7684\u63a5\u53e3\u53ebWriter \uff0c \u6709\u5b57\u7b26\u4e32\u529f\u80fd\u7684\u63a5\u53e3\u53ebStringer \uff0c \u6709\u5173\u95ed\u529f\u80fd\u7684\u63a5\u53e3\u53ebCloser \u7b49<\/li>\n\n\n\n<li>\u65b9\u6cd5\u540d\uff1a <strong>\u5f53\u65b9\u6cd5\u540d\u9996\u5b57\u6bcd\u662f\u5927\u5199\u65f6\uff0c \u4e14\u8fd9\u4e2a\u63a5\u53e3\u7c7b\u578b\u540d\u9996\u5b57\u6bcd\u4e5f\u662f\u5927\u5199\u65f6\uff0c\u8fd9\u4e2a\u65b9\u6cd5\u53ef\u4ee5\u88ab\u63a5\u53e3\u6240\u5728\u7684\u5305\uff08package \uff09\u4e4b\u5916\u7684\u4ee3\u7801\u8bbf\u95ee<\/strong>\u3002<\/li>\n\n\n\n<li> \u53c2\u6570\u5217\u8868\u3001\u8fd4\u56de\u503c\u5217\u8868\uff1a \u53c2\u6570\u5217\u8868\u548c\u8fd4\u56de\u503c\u5217\u8868\u4e2d\u7684\u53c2\u6570\u53d8\u91cf\u540d\u53ef\u4ee5\u88ab\u5ffd\u7565 <\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"552\" height=\"162\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/05\/20-2.png\" alt=\"\" class=\"wp-image-3900\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/05\/20-2.png 552w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/05\/20-2-300x88.png 300w\" sizes=\"auto, (max-width: 552px) 100vw, 552px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2\u3001\u5f00\u53d1\u4e2d\u5e38\u89c1\u7684\u63a5\u53e3\u53ca\u5199\u6cd5<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Go \u8bed\u8a00\u63d0\u4f9b\u7684\u5f88\u591a\u5305\u4e2d\u90fd\u6709\u63a5\u53e3\uff0c\u4f8b\u5982io \u5305\u4e2d\u63d0\u4f9b\u7684Writer \u63a5\u53e3\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>type Writer interface {\n    Write( p &#91;]byte ) (n int , err error )\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u4e2a\u63a5\u53e3\u53ef\u4ee5\u8c03\u7528Write()\u65b9\u6cd5\u5199\u5165\u4e00\u4e2a\u5b57\u8282\u6570\u7ec4\uff08[]byte\uff09 \uff0c\u8fd4\u56de\u503c\u544a\u77e5\u5199\u5165\u5b57\u8282\u6570(n int \uff09\u548c\u53ef\u80fd\u53d1\u751f\u7684\u9519\u8bef\uff08 err error \uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7c7b\u4f3c\u7684\uff0c\u8fd8\u6709\u5c06\u4e00\u4e2a\u5bf9\u8c61\u4ee5\u5b57\u7b26\u4e32\u5f62\u5f0f\u5c55\u73b0\u7684\u63a5\u53e3\uff0c \u53ea\u8981\u5b9e\u73b0\u4e86\u8fd9\u4e2a\u63a5\u53e3\u7684\u7c7b\u578b\uff0c \u5728\u8c03\u7528String()\u65b9\u6cd5\u65f6\uff0c \u90fd\u53ef\u4ee5\u83b7\u5f97\u5bf9\u8c61\u5bf9\u5e94\u7684\u5b57\u7b26\u4e32\u3002\u5728fmt \u5305\u4e2d\u5b9a\u4e49\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>type Stringer interface {\n    String( ) string\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Stringer \u63a5\u53e3\u5728Go \u8bed\u8a00\u4e2d\u7684\u4f7f\u7528\u9891\u7387\u975e\u5e38\u9ad8\uff0c\u529f\u80fd\u7c7b\u4f3c\u4e8eJava \u6216\u8005C \uff03\u8bed\u8a00\u91cc\u7684ToString \u7684\u64cd\u4f5c<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Go \u8bed\u8a00\u7684\u6bcf\u4e2a\u63a5\u53e3\u4e2d\u7684\u65b9\u6cd5\u6570\u91cf\u4e0d\u4f1a\u5f88\u591a\u3002Go \u8bed\u8a00\u5e0c\u671b\u901a\u8fc7\u4e00\u4e2a\u63a5\u53e3\u7cbe\u51c6\u63cf\u8ff0\u5b83\u81ea\u5df1\u7684\u529f\u80fd\uff0c\u800c\u901a\u8fc7\u591a\u4e2a\u63a5\u53e3\u7684\u5d4c\u5165\u548c\u7ec4\u5408\u7684\u65b9\u5f0f\u5c06\u7b80\u5355\u7684\u63a5\u53e3\u6269\u5c55\u4e3a\u590d\u6742\u7684\u63a5\u53e3<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>\u4e8c\u3001\u5b9e\u73b0\u63a5\u53e3\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a5\u53e3\u5b9a\u4e49\u540e\uff0c \u9700\u8981\u5b9e\u73b0\u63a5\u53e3\uff0c \u8c03\u7528\u65b9\u624d\u80fd\u6b63\u786e\u7f16\u8bd1\u901a\u8fc7\u5e76\u4f7f\u7528\u63a5\u53e3\u3002\u63a5\u53e3\u7684\u5b9e\u73b0\u9700\u8981\u9075\u5faa\u4e24\u6761\u89c4\u5219\u624d\u80fd\u8ba9\u63a5\u53e3\u53ef\u7528<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1\u3001\u6761\u4ef6\u4e00\uff1a\u63a5\u53e3\u7684\u65b9\u6cd5\u4e0e\u5b9e\u73b0\u63a5\u53e3\u7684\u7c7b\u578b\u65b9\u6cd5\u683c\u5f0f\u4e00\u81f4<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u7c7b\u578b\u4e2d\u6dfb\u52a0\u4e0e\u63a5\u53e3\u7b7e\u540d\u4e00\u81f4\u7684\u65b9\u6cd5\u5c31\u53ef\u4ee5\u5b9e\u73b0\u8be5\u65b9\u6cd5\u3002\u7b7e\u540d\u5305\u62ec\u65b9\u6cd5\u4e2d\u7684\u540d\u79f0\u3001\u53c2\u6570\u5217\u8868\u3001\u8fd4\u56de\u53c2\u6570\u5217\u8868\u3002<strong>\u4e5f\u5c31\u662f\u8bf4\uff0c\u53ea\u8981\u5b9e\u73b0\u63a5\u53e3\u7c7b\u578b\u4e2d\u7684\u65b9\u6cd5\u7684\u540d\u79f0\u3001\u53c2\u6570\u5217\u8868\u3001\u8fd4\u56de\u53c2\u6570\u5217\u8868\u4e2d\u7684\u4efb\u610f\u4e00\u9879\u4e0e\u63a5\u53e3\u8981\u5b9e\u73b0\u7684\u65b9\u6cd5\u4e0d\u4e00\u81f4\uff0c\u90a3\u4e48\u63a5\u53e3\u7684\u8fd9\u4e2a\u65b9\u6cd5\u5c31\u4e0d\u4f1a\u88ab\u5b9e\u73b0\u3002<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3a\u4e86\u62bd\u8c61\u6570\u636e\u5199\u5165\u7684\u8fc7\u7a0b\uff0c\u5b9a\u4e49DataWriter \u63a5\u53e3\u6765\u63cf\u8ff0\u6570\u636e\u5199\u5165\u9700\u8981\u5b9e\u73b0\u7684\u65b9\u6cd5\uff0c\u63a5\u53e3\u4e2d\u7684WriteData()\u65b9\u6cd5\u8868\u793a\u5c06\u6570\u636e\u5199\u5165\uff0c\u5199\u5165\u65b9\u65e0\u987b\u5173\u5fc3\u5199\u5165\u5230\u54ea\u91cc\u3002\u5b9e\u73b0\u63a5\u53e3\u7684\u7c7b\u578b\u5b9e\u73b0WriteData \u65b9\u6cd5\u65f6\uff0c \u4f1a\u5177\u4f53\u7f16\u5199\u5c06\u6570\u636e\u5199\u5165\u5230\u4ec0\u4e48\u7ed3\u6784\u4e2d\u3002\u8fd9\u91cc\u4f7f\u7528file \u7ed3\u6784\u4f53\u5b9e\u73b0DataWriter \u63a5\u53e3\u7684WriteData \u65b9\u6cd5\uff0c\u65b9\u6cd5\u5185\u90e8\u53ea\u662f\u6253\u5370\u4e00\u4e2a\u65e5\u5fd7\uff0c\u8868\u793a\u6709\u6570\u636e\u5199\u5165\uff0c\u5982\u56fe:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"424\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/1-1.png\" alt=\"\" class=\"wp-image-6760\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/1-1.png 707w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/1-1-300x180.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/1-1-600x360.png 600w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7b2c7\u884c\uff1a\u9996\u5148\u5b9a\u4e49DataWriter \u63a5\u53e3\u3002\u8fd9\u4e2a\u63a5\u53e3\u53ea\u6709\u4e00\u4e2a\u65b9\u6cd5\uff0c\u5373WriteData()\uff0c\u8f93\u5165\u4e00\u4e2ainterface{}\u7c7b\u578b\u7684data \uff0c \u8fd4\u56de\u4e00\u4e2aerror\u7ed3\u6784\u8868\u793a\u53ef\u80fd\u53d1\u751f\u7684\u9519\u8bef\u3002<\/li>\n\n\n\n<li>\u7b2c10\u884c\uff1a\u5b9a\u4e49\u6587\u4ef6\u7ed3\u6784\uff0c\u7528\u4e8e\u5b9e\u73b0DataWriter<\/li>\n\n\n\n<li>\u7b2c12\u884c\uff1afile \u7684WriteData()\u65b9\u6cd5\u4f7f\u7528\u6307\u9488\u63a5\u6536\u5668\u3002\u8f93\u5165\u4e00\u4e2ainterface{}\u7c7b\u578b\u7684data,\u8fd4\u56deerror<\/li>\n\n\n\n<li>\u7b2c17\u884c\uff1a\u5b9e\u4f8b\u5316file\u8d4b\u503c\u7ed9f, f \u7684\u7c7b\u578b\u4e3a*file<\/li>\n\n\n\n<li>\u7b2c18\u884c\uff1a\u58f0\u660eDataWriter \u7c7b\u578b\u7684writer \u63a5\u53e3\u53d8\u91cf<\/li>\n\n\n\n<li>\u7b2c19\u884c\uff1a\u5c06f \u8d4b\u503c\u7ed9DataWriter \u63a5\u53e3\u7684writer \uff0c \u867d\u7136\u4e24\u4e2a\u53d8\u91cf\u7c7b\u578b\u4e0d\u4e00\u81f4\u3002\u4f46\u662fwriter \u662f\u4e00\u4e2a\u63a5\u53e3\uff0c \u4e14f \u5df1\u7ecf\u5b8c\u5168\u5b9e\u73b0\u4e86DataWriter()\u7684\u6240\u6709\u65b9\u6cd5\uff0c\u56e0\u6b64\u8d4b\u503c\u662f\u6210\u529f\u7684<\/li>\n\n\n\n<li>\u7b2c20\u884c\uff1aDataWriter \u63a5\u53e3\u7c7b\u578b\u7684writer \u4f7f\u7528WriteData\uff08\uff09\u65b9\u6cd5\u5199\u5165\u4e00\u4e2a\u5b57\u7b26\u4e32\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u4ece\u4e0a\u56fe\u4e2d\u53ef\u4ee5\u770b\u51fa\uff0c\u5b9e\u73b0\u63a5\u53e3\u7c7b\u578b\u4e2d\u7684\u65b9\u6cd5\u3001\u53c2\u6570\u5217\u8868\u3001\u8fd4\u56de\u503c\u7c7b\u578b\u4e0e\u63a5\u53e3\u4e2d\u5b9a\u4e49\u7684\u662f\u4e00\u81f4\u7684WriteData(data interface[]) error<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee3\u7801\u6267\u884c\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"146\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/2-1.png\" alt=\"\" class=\"wp-image-6763\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/2-1.png 708w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/2-1-300x62.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/2-1-600x124.png 600w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f53\u7c7b\u578b\u65e0\u6cd5\u5b9e\u73b0\u63a5\u53e3\u65f6\uff0c\u7f16\u8bd1\u5668\u4f1a\u62a5\u9519\uff0c\u4e0b\u9762\u5217\u51fa\u5e38\u89c1\u7684\u51e0\u79cd\u63a5\u53e3\u65e0\u6cd5\u5b9e\u73b0\u7684\u9519\u8bef\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u51fd\u6570\u540d\u4e0d\u4e00\u81f4\u5bfc\u81f4\u7684\u62a5\u9519<\/li>\n\n\n\n<li>\u5b9e\u73b0\u63a5\u53e3\u7684\u65b9\u6cd5\u7b7e\u540d\u4e0d\u4e00\u81f4\u5bfc\u81f4\u7684\u62a5\u9519(\u53c2\u6570\uff0c\u8fd4\u56de\u503c)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2\u3001\u6761\u4ef6\u4e8c\uff1a\u63a5\u53e3\u4e2d\u6240\u6709\u65b9\u6cd5\u5747\u88ab\u5b9e\u73b0<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f53\u4e00\u4e2a\u63a5\u53e3\u4e2d\u6709\u591a\u4e2a\u65b9\u6cd5\u65f6\uff0c<strong>\u53ea\u6709\u8fd9\u4e9b\u65b9\u6cd5\u90fd\u88ab\u5b9e\u73b0\u4e86\uff0c\u63a5\u53e3\u624d\u80fd\u88ab\u6b63\u786e\u7f16\u8bd1\u5e76\u4f7f\u7528<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f8b\u5982\uff1a\u5728\u4e0a\u9762\u63a5\u53e3\u4e2d\uff0c\u6dfb\u52a0\u4e00\u4e2a\u65b9\u6cd5\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"586\" height=\"384\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/03\/36.png\" alt=\"\" class=\"wp-image-3408\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/03\/36.png 586w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/03\/36-300x197.png 300w\" sizes=\"auto, (max-width: 586px) 100vw, 586px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee3\u7801\u6267\u884c\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"577\" height=\"173\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/03\/37.png\" alt=\"\" class=\"wp-image-3409\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/03\/37.png 577w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/03\/37-300x90.png 300w\" sizes=\"auto, (max-width: 577px) 100vw, 577px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u62a5\u9519\u7684\u539f\u56e0\u662f\u56e0\u4e3aCanWrite()\u65b9\u6cd5\u6ca1\u6709\u88ab\u5b9e\u73b0\uff0c\u9700\u8981\u5728file\u4e2d\u5b9e\u73b0CanWrite()\u65b9\u6cd5\u624d\u80fd\u6b63\u5e38\u4f7f\u7528DataWriter()<\/p>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">Go \u8bed\u8a00\u7684\u63a5\u53e3\u5b9e\u73b0\u662f\u9690\u5f0f\u7684\uff0c\u65e0\u987b\u8ba9\u5b9e\u73b0\u63a5\u53e3\u7684\u7c7b\u578b\u5199\u51fa\u5b9e\u73b0\u4e86\u54ea\u4e9b\u63a5\u53e3\u3002\u8fd9\u4e2a\u8bbe\u8ba1\u88ab\u79f0\u4e3a\u975e\u4fb5\u5165\u5f0f\u8bbe\u8ba1(\u53ea\u8981\u5b9e\u73b0\u4e86\u63a5\u53e3\u4e2d\u7684\u6240\u6709\u65b9\u6cd5\uff0c\u5c31\u5b9e\u73b0\u4e86\u6b64\u63a5\u53e3)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3\u3001\u63a5\u53e3\u7c7b\u578b\u53d8\u91cf\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a5\u53e3\u7c7b\u578b\u53d8\u91cf\u80fd\u591f\u5b58\u50a8\u6240\u6709\u5b9e\u73b0\u4e86\u8be5\u63a5\u53e3\u7684\u5b9e\u4f8b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f8b\u5982\uff1a\u4e0b\u9762\u4f8b\u5b50\u8868\u793a\u901a\u8fc7\u63a5\u53e3\u7c7b\u578b\u53d8\u91cf\u6765\u8bbf\u95ee\u5b9e\u4f8b\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"513\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/5-1.png\" alt=\"\" class=\"wp-image-6779\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/5-1.png 707w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/5-1-300x218.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/5-1-600x435.png 600w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7b2c5-7\u884c\uff1a\u58f0\u660eSayer\u63a5\u53e3\uff0c\u65b9\u6cd5\u4e3asay()<\/li>\n\n\n\n<li>\u7b2c8-9\u884c\uff1a\u5b9a\u4e49Cat\u548cDog\u4e24\u4e2a\u7ed3\u6784\u4f53<\/li>\n\n\n\n<li>\u7b2c11-16\u884c\uff1aCat\u548cDog\u5206\u522b\u5b9e\u73b0\u4e86say()\u65b9\u6cd5\uff0c\u5c31\u53ef\u4ee5\u5b9e\u73b0Sayer\u63a5\u53e3\uff0c\u63a5\u6536\u8005\u7c7b\u578b\u4e3a\u503c\u63a5\u53d7\u8005<\/li>\n\n\n\n<li>\u7b2c19\u884c\uff1a\u58f0\u660eSayer\u7c7b\u578b\u7684\u53d8\u91cfs<\/li>\n\n\n\n<li>\u7b2c20-21\u884c\uff1a\u5b9e\u4f8b\u5316Cat\u548cDog\u7ed3\u6784\u4f53<\/li>\n\n\n\n<li>\u7b2c22\u884c\uff1a\u5c06Cat\u5b9e\u4f8b\u76f4\u63a5\u8d4b\u503c\u7ed9\u53d8\u91cfs<\/li>\n\n\n\n<li>\u7b2c23\u884c\uff1a\u53d8\u91cf\u76f4\u63a5\u8c03\u7528say()\u65b9\u6cd5<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee3\u7801\u6267\u884c\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"95\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/6-1.png\" alt=\"\" class=\"wp-image-6784\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/6-1.png 706w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/6-1-300x40.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/6-1-600x81.png 600w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1a\u7ed3\u6784\u4f53\u65b9\u6cd5\u5fc5\u987b\u5b9e\u73b0\u4e86\u63a5\u53e3\u540e\u624d\u53ef\u7ed9\u63a5\u53e3\u53d8\u91cf\u8d4b\u503c\uff0c\u4f8b\u5982\u4e0a\u9762\u7684\u7ed3\u6784\u4f53Cat\u548cDog\u7ed3\u6784\u4f53\u90fd\u5b9e\u73b0\u4e86Sayer\u63a5\u53e3\uff0c\u56e0\u6b64a := Cat{}\u548cb := Dog{}\u624d\u4e0d\u4f1a\u62a5\u9519<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>4\u3001\u503c\u63a5\u6536\u8005\u548c\u6307\u9488\u63a5\u6536\u8005\u5b9e\u73b0\u63a5\u53e3\u7684\u533a\u522b<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4.1 \u4e0b\u9762\u4f8b\u5b50\u8868\u793a\u901a\u8fc7<strong>\u503c\u63a5\u6536\u8005<\/strong>\u6765\u5b9e\u73b0\u63a5\u53e3\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"565\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/9-1.png\" alt=\"\" class=\"wp-image-6789\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/9-1.png 710w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/9-1-300x239.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/9-1-600x477.png 600w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u6267\u884c\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"139\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/8-1.png\" alt=\"\" class=\"wp-image-6788\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/8-1.png 707w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/8-1-300x59.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/8-1-600x118.png 600w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u4e0a\u56fe\u4e2d\u53ef\u4ee5\u770b\u51fa\uff0ca\u7684\u7c7b\u578b\u4e3a\u503c\u7c7b\u578b\uff0cb\u7684\u7c7b\u578b\u4e3a\u6307\u9488\u7c7b\u578b\uff0c\u4f7f\u7528\u503c\u63a5\u6536\u8005\u5b9e\u73b0\u63a5\u53e3\u4e4b\u540e\uff0c<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u4e0d\u7ba1\u662fCat\u7ed3\u6784\u4f53\u8fd8\u662f\u7ed3\u6784\u4f53\u6307\u9488*Cat\u7c7b\u578b\u7684\u53d8\u91cf\u90fd\u53ef\u4ee5\u8d4b\u503c\u7ed9\u8be5\u63a5\u53e3\u53d8\u91cf<\/mark><\/strong>\uff0c\u56e0\u4e3aGo\u8bed\u8a00\u4e2d\u6709\u5bf9\u6307\u9488\u7c7b\u578b\u53d8\u91cf\u6c42\u503c\u7684\u8bed\u6cd5\u7cd6\uff0cCat\u6307\u9488b\u5185\u90e8\u4f1a\u81ea\u52a8\u6c42\u503c*b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4.2 \u4e0b\u9762\u4f8b\u5b50\u901a\u8fc7<strong>\u6307\u9488\u63a5\u6536\u8005<\/strong>\u5b9e\u73b0\u63a5\u53e3\uff0c\u5c06\u4e0a\u56fe\u4e2d\u7684\u63a5\u6536\u8005\u6539\u4e3a*Cat\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"555\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/10-1.png\" alt=\"\" class=\"wp-image-6795\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/10-1.png 708w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/10-1-300x235.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/10-1-600x470.png 600w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee3\u7801\u6267\u884c\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"137\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/11.png\" alt=\"\" class=\"wp-image-6796\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/11.png 708w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/11-300x58.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/11-600x116.png 600w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u4e0a\u56fe\u53ef\u4ee5\u770b\u51fa\uff0c\u6267\u884c\u7ed3\u679c\u62a5\u9519\u4e86\uff0c\u56e0\u4e3a\u63a5\u6536\u7c7b\u578b\u4e3a\u6307\u9488\u7c7b\u578b\uff0c\u56e0\u6b64\u4e0d\u80fd\u4f20\u9012\u503c\u7c7b\u578bcat\uff0c\u73b0\u5728\u5c06\u503c\u7c7b\u578b\u7684\u8d4b\u503c\u6ce8\u91ca\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"538\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/12.png\" alt=\"\" class=\"wp-image-6798\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/12.png 706w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/12-300x229.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/12-600x457.png 600w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd0\u884c\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"133\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/13.png\" alt=\"\" class=\"wp-image-6799\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/13.png 709w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/13-300x56.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/13-600x113.png 600w\" sizes=\"auto, (max-width: 709px) 100vw, 709px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u7531\u4e8e\u63a5\u6536\u8005\u7c7b\u578b\u4e3a\u6307\u9488\u7c7b\u578b\uff0c\u56e0\u6b64\u53ea\u80fd\u7ed9\u63a5\u53e3\u53d8\u91cfs\u4f20\u9012\u6307\u9488\u7c7b\u578b\u7684\u53d8\u91cf\uff0cs\u53ea\u80fd\u5b58\u50a8*Cat\u7c7b\u578b\u7684\u503c<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5\u3001<strong>\u4e0b\u9762\u4f8b\u5b50\u5c06\u63a5\u53e3\u4f5c\u4e3a\u65b9\u6cd5\u7684\u8fd4\u56de\u503c\uff0c\u5982\u56fe\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"694\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/12\/1-9.png\" alt=\"\" class=\"wp-image-11161\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/12\/1-9.png 709w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/12\/1-9-300x294.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/12\/1-9-600x587.png 600w\" sizes=\"auto, (max-width: 709px) 100vw, 709px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7b2c6\u884c\uff1a\u5b9a\u4e49\u63a5\u53e3interOne\u4e2d\u7684\u65b9\u6cd5abc()\uff0c\u65b9\u6cd5\u65e0\u53c2\u6570\uff0c\u8fd4\u56de\u503c\u4e3a\u63a5\u53e3interTwo<\/li>\n\n\n\n<li>\u7b2c9\u884c\uff1a\u5b9a\u4e49\u63a5\u53e3interTwo\u4e2d\u7684\u65b9\u6cd5def(),\u65b9\u6cd5\u65e0\u53c2\u6570,\u65e0\u8fd4\u56de\u503c<\/li>\n\n\n\n<li>\u7b2c11\u884c\uff1a\u5b9a\u4e49\u7ed3\u6784\u4f53strOne<\/li>\n\n\n\n<li>\u7b2c14\u884c\uff1a\u5b9a\u4e49\u7ed3\u6784\u4f53strTwo<\/li>\n\n\n\n<li>\u7b2c18\u884c\uff1a\u7ed3\u6784\u4f53strOne\u5b9e\u73b0\u4e86\u63a5\u53e3interOne\uff0c\u56e0\u4e3a\u65b9\u6cd5\u540d\u548c\u8fd4\u56de\u503c\u5217\u8868\u4e0e\u63a5\u53e3\u4fdd\u6301\u4e00\u81f4<\/li>\n\n\n\n<li>\u7b2c23\u884c\uff1a\u7ed3\u6784\u4f53strTwo\u5b9e\u73b0\u4e86\u63a5\u53e3interTwo\uff0c\u56e0\u4e3a\u65b9\u6cd5\u540d\u548c\u8fd4\u56de\u503c\u5217\u8868\u4e0e\u63a5\u53e3\u4fdd\u6301\u4e00\u81f4<\/li>\n\n\n\n<li>\u7b2c27\u884c\uff1a\u58f0\u660e\u63a5\u53e3\u53d8\u91cf<\/li>\n\n\n\n<li>\u7b2c28\u884c\uff1a \u5b9e\u4f8b\u5316\u7ed3\u6784\u4f53strOne<\/li>\n\n\n\n<li>\u7b2c31\u884c\uff1a\u5c06\u5b9e\u4f8b\u5316\u540e\u7684\u7ed3\u6784\u4f53\u8d4b\u503c\u7ed9\u63a5\u53e3\u53d8\u91cf,\u56e0\u4e3a\u5b9e\u73b0\u4e86\u63a5\u53e3\uff0c\u56e0\u6b64\u53ef\u8d4b\u503c\u7ed9\u63a5\u53e3<\/li>\n\n\n\n<li>\u7b2c32\u884c\uff1a\u8c03\u7528\u63a5\u53e3\u65b9\u6cd5abc()\uff0c\u5b9e\u9645\u8fd4\u56de\u7c7b\u578b\u4e3ainterTwo\uff0cinterTwo\u5bf9\u5e94\u7684\u503c\u4e3astrTwo\u7ed3\u6784\u4f53<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd0\u884c\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"70\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/12\/2-8.png\" alt=\"\" class=\"wp-image-11165\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/12\/2-8.png 709w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/12\/2-8-300x30.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/12\/2-8-600x59.png 600w\" sizes=\"auto, (max-width: 709px) 100vw, 709px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u8bf4\u660e\uff1a\u7b2c18\u884c\uff0c\u5b9e\u73b0\u63a5\u53e3interOne\u540e\uff0c\u8fd4\u56de\u503c\u7684\u7c7b\u578b\u4e3ainterTwo\uff0c\u7531\u4e8einterTwo\u4e3a\u63a5\u53e3\u7c7b\u578b\uff0c\u53ea\u6709\u5b9e\u73b0\u4e86\u6b64\u63a5\u53e3\u7684\u7ed3\u6784\u4f53\uff0c\u624d\u53ef\u4ee5\u5c06\u503c\u8d4b\u503c\u7ed9\u6b64\u63a5\u53e3\uff0c\u4e0a\u56fe\u4e2dstrTwo\u7ed3\u6784\u4f53\u5b9e\u73b0\u4e86\u63a5\u53e3interTwo\uff0c\u56e0\u6b64\u53ef\u5c06\u5b9e\u4f8b\u5316\u7ed3\u6784\u4f53\u4f5c\u4e3ainterTwo\u7684\u503c\uff0c\u4e5f\u5c31\u662f\u4e0a\u56fe\u4e2d\u768419-21\u884c<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>\u4e09\u3001\u7406\u89e3\u7c7b\u578b\u4e0e\u63a5\u53e3\u7684\u5173\u7cfb<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7c7b\u578b\u548c\u63a5\u53e3\u4e4b\u95f4\u6709\u4e00\u5bf9\u591a\u548c\u591a\u5bf9\u4e00\u7684\u5173\u7cfb<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1\u3001\u4e00\u4e2a\u7c7b\u578b\u53ef\u4ee5\u5b9e\u73b0\u591a\u4e2a\u63a5\u53e3\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u4e2a\u7c7b\u578b\u53ef\u4ee5\u540c\u65f6\u5b9e\u73b0\u591a\u4e2a\u63a5\u53e3\uff0c \u800c\u63a5\u53e3\u95f4\u5f7c\u6b64\u72ec\u7acb\uff0c\u4e0d\u77e5\u9053\u5bf9\u65b9\u7684\u5b9e\u73b0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u4f8b\u5b50\u5b9a\u4e49\u8bf4\u8bdd\u548c\u79fb\u52a8\u4e24\u4e2a\u63a5\u53e3\uff0c\u5e76\u5b9a\u4e49cat\u7ed3\u6784\u4f53\uff0c\u7528\u6765\u5b9e\u73b0\u8fd9\u4e24\u4e2a\u63a5\u53e3\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"566\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/15.png\" alt=\"\" class=\"wp-image-6805\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/15.png 710w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/15-300x239.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/15-600x478.png 600w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee3\u7801\u8fd0\u884c\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"101\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/16.png\" alt=\"\" class=\"wp-image-6807\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/16.png 708w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/16-300x43.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/16-600x86.png 600w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2\u3001\u591a\u4e2a\u7c7b\u578b\u53ef\u4ee5\u5b9e\u73b0\u76f8\u540c\u7684\u63a5\u53e3\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> Go\u8bed\u8a00\u4e2d\u4e0d\u540c\u7684\u7c7b\u578b\u8fd8\u53ef\u4ee5\u5b9e\u73b0\u540c\u4e00\u63a5\u53e3<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u4f8b\u5b50\u8868\u793a\u591a\u4e2a\u7c7b\u578b\u5b9e\u73b0\u540c\u4e00\u63a5\u53e3\uff0c\u72d7\u548c\u6c7d\u8f66\u90fd\u5b9e\u73b0\u4e86\u53ef\u4ee5\u79fb\u52a8\u7684\u63a5\u53e3\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"582\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/17.png\" alt=\"\" class=\"wp-image-6809\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/17.png 707w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/17-300x247.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/17-600x494.png 600w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u6267\u884c\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"110\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/18.png\" alt=\"\" class=\"wp-image-6811\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/18.png 707w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/18-300x47.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/18-600x93.png 600w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u4e2a\u63a5\u53e3\u7684\u65b9\u6cd5\uff0c\u4e0d\u4e00\u5b9a\u9700\u8981\u7531\u4e00\u4e2a\u7c7b\u578b\u5b8c\u5168\u5b9e\u73b0\uff0c\u63a5\u53e3\u7684\u65b9\u6cd5\u53ef\u4ee5\u901a\u8fc7\u5728\u7c7b\u578b\u4e2d\u5d4c\u5165\u5176\u4ed6\u7c7b\u578b\u6216\u8005\u7ed3\u6784\u4f53\u6765\u5b9e\u73b0\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u4f8b\u5b50\u5b9a\u4e49motion\u63a5\u53e3\uff0c\u5176\u4e2d\u4e24\u4e2a\u65b9\u6cd5\uff0c\u5b9a\u4e49\u4e24\u4e2a\u7ed3\u6784\u4f53\uff0c\u4e00\u4e2a\u5d4c\u5165\u5230\u53e6\u4e00\u4e2a\u4e2d\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"565\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/19.png\" alt=\"\" class=\"wp-image-6814\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/19.png 709w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/19-300x239.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/19-600x478.png 600w\" sizes=\"auto, (max-width: 709px) 100vw, 709px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd0\u884c\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"131\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/20.png\" alt=\"\" class=\"wp-image-6816\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/20.png 707w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/20-300x56.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/20-600x111.png 600w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3\u3001\u63a5\u53e3\u5d4c\u5957\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a5\u53e3\u4e0e\u63a5\u53e3\u95f4\u53ef\u4ee5\u901a\u8fc7\u5d4c\u5957\u521b\u9020\u51fa\u65b0\u7684\u63a5\u53e3\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"581\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/21.png\" alt=\"\" class=\"wp-image-6819\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/21.png 707w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/21-300x247.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/21-600x493.png 600w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"108\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/22.png\" alt=\"\" class=\"wp-image-6820\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/22.png 707w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/22-300x46.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/22-600x92.png 600w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>4\u3001\u7a7a\u63a5\u53e3\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7a7a\u63a5\u53e3\u662f\u6307\u6ca1\u6709\u5b9a\u4e49\u4efb\u4f55\u65b9\u6cd5\u7684\u63a5\u53e3\u3002\u56e0\u6b64\u4efb\u4f55\u7c7b\u578b\u90fd\u5b9e\u73b0\u4e86\u7a7a\u63a5\u53e3\uff0c\u7a7a\u63a5\u53e3\u7c7b\u578b\u7684\u53d8\u91cf\u53ef\u4ee5\u5b58\u50a8\u4efb\u610f\u7c7b\u578b\u7684\u53d8\u91cf\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"328\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/24.png\" alt=\"\" class=\"wp-image-6824\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/24.png 707w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/24-300x139.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/24-600x278.png 600w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"127\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/25.png\" alt=\"\" class=\"wp-image-6826\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/25.png 706w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/25-300x54.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/25-600x108.png 600w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u4e0a\u56fe\u4e2d\u53ef\u4ee5\u770b\u51fa\uff0c\u50cf\u7a7a\u63a5\u53e3\u4e2d\u8d4b\u503c\u4efb\u610f\u7c7b\u578b\u7684\u53d8\u91cf\uff0c\u90fd\u53ef\u4ee5\u6b63\u5e38\u6253\u5370\u51fa\u6765<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u58f0\u660e\u7a7a\u63a5\u53e3\u7c7b\u578b\u7684\u5207\u7247\uff0c\u5e76\u8d4b\u4e0d\u540c\u7684\u503c\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"651\" height=\"251\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/2-3.png\" alt=\"\" class=\"wp-image-18141\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/2-3.png 651w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/2-3-300x116.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/2-3-600x231.png 600w\" sizes=\"auto, (max-width: 651px) 100vw, 651px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"650\" height=\"122\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/3-3.png\" alt=\"\" class=\"wp-image-18142\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/3-3.png 650w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/3-3-300x56.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/3-3-600x113.png 600w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">5<strong>\u3001\u7a7a\u63a5\u53e3\u7684\u5e94\u7528<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7a7a\u63a5\u53e3\u4f5c\u4e3a\u51fd\u6570\u7684\u53c2\u6570\uff0c\u4f7f\u7528\u7a7a\u63a5\u53e3\u5b9e\u73b0\u53ef\u4ee5\u63a5\u6536\u4efb\u610f\u7c7b\u578b\u7684\u51fd\u6570\u53c2\u6570\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"253\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/26.png\" alt=\"\" class=\"wp-image-6828\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/26.png 706w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/26-300x108.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/26-600x215.png 600w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u7a7a\u63a5\u53e3\u4f5c\u4e3amap\u7684\u503c\uff0c\u4f7f\u7528\u7a7a\u63a5\u53e3\u5b9e\u73b0\u53ef\u4ee5\u4fdd\u5b58\u4efb\u610f\u503c\u7684\u5b57\u5178\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"705\" height=\"221\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/27.png\" alt=\"\" class=\"wp-image-6830\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/27.png 705w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/27-300x94.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/27-600x188.png 600w\" sizes=\"auto, (max-width: 705px) 100vw, 705px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>6\u3001\u4ece\u7a7a\u63a5\u53e3\u53d6\u503c\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4fdd\u5b58\u5230\u7a7a\u63a5\u53e3\u7684\u503c\uff0c\u5982\u679c\u76f4\u63a5\u53d6\u51fa\u6307\u5b9a\u7c7b\u578b\u7684\u503c\u65f6\uff0c\u4f1a\u53d1\u751f\u7f16\u8bd1\u9519\u8bef\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"293\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/5-2.png\" alt=\"\" class=\"wp-image-6846\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/5-2.png 706w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/5-2-300x125.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/5-2-600x249.png 600w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u7f16\u8bd1\u8fd0\u884c\u5c06\u51fa\u73b0\u9519\u8bef\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"150\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/6-2.png\" alt=\"\" class=\"wp-image-6847\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/6-2.png 709w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/6-2-300x63.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/6-2-600x127.png 600w\" sizes=\"auto, (max-width: 709px) 100vw, 709px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u4e0a\u56fe\u53ef\u4ee5\u770b\u51fa\uff0c\u7f16\u8bd1\u5668\u63d0\u793a\u4e0d\u80fd\u5c06x\u53d8\u91cf\u4f5c\u4e3aint\u7c7b\u578b\u8d4b\u503c\u7ed9b\uff0c\u56e0\u4e3ax\u7684\u7c7b\u578b\u4e3ainterface{}\u7c7b\u578b\uff0c\u5e76\u4e14\u63d0\u793a\u6211\u4eec\u4f7f\u7528type assertion\uff0c\u4e5f\u5c31\u662f<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u7c7b\u578b\u65ad\u8a00<\/mark><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u901a\u8fc7\u7c7b\u578b\u65ad\u8a00\u6765\u91cd\u65b0\u4fee\u6539\u4ee3\u7801\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"269\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/7-2.png\" alt=\"\" class=\"wp-image-6849\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/7-2.png 707w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/7-2-300x114.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/7-2-600x228.png 600w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee3\u7801\u6267\u884c\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"73\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/8-2.png\" alt=\"\" class=\"wp-image-6850\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/8-2.png 704w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/8-2-300x31.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/8-2-600x62.png 600w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1a\u7a7a\u63a5\u53e3\u6ca1\u6709\u4efb\u4f55\u65b9\u6cd5\uff0c\u56e0\u6b64\u7a7a\u63a5\u53e3\u7c7b\u578b\u7684\u503c\u4e0d\u53ef\u8c03\u7528\u522b\u7684\u65b9\u6cd5\uff0c\u4f1a\u62a5\u9519\uff0c\u53ef\u901a\u8fc7\u7c7b\u578b\u65ad\u8a00\u6765\u8c03\u7528<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>7\u3001\u7c7b\u578b\u65ad\u8a00\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7a7a\u63a5\u53e3\u53ef\u4ee5\u5b58\u50a8\u4efb\u610f\u7c7b\u578b\u7684\u503c\uff0c\u90a3\u6211\u4eec\u5982\u4f55\u83b7\u53d6\u5176\u5b58\u50a8\u7684\u5177\u4f53\u6570\u636e\u5462\uff1f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u4e2a\u63a5\u53e3\u7684\u503c\uff08\u7b80\u79f0\u63a5\u53e3\u503c\uff09\u662f\u7531\u4e00\u4e2a\u5177\u4f53\u7c7b\u578b\u548c\u5177\u4f53\u7c7b\u578b\u7684\u503c\u4e24\u90e8\u5206\u7ec4\u6210\u7684\u3002\u8fd9\u4e24\u90e8\u5206\u5206\u522b\u79f0\u4e3a\u63a5\u53e3\u7684\u52a8\u6001\u7c7b\u578b\u548c\u52a8\u6001\u503c<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u60f3\u8981<strong>\u5224\u65ad\u7a7a\u63a5\u53e3\u4e2d\u7684\u503c<\/strong>\u8fd9\u4e2a\u65f6\u5019\u5c31\u53ef\u4ee5\u4f7f\u7528\u7c7b\u578b\u65ad\u8a00\uff0c\u5176\u8bed\u6cd5\u683c\u5f0f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>t := i.(T)<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>i \u4ee3\u8868\u63a5\u53e3\u53d8\u91cf(<strong>\u6ce8\u610f\uff1a\u53ea\u6709\u63a5\u53e3\u53d8\u91cf\u624d\u6709\u65ad\u8a00\u7684\u529f\u80fd<\/strong>)<\/li>\n\n\n\n<li>T \u4ee3\u8868\u65ad\u8a00i\u53ef\u80fd\u662f\u7684\u7c7b\u578b(\u5c06i\u8f6c\u6362\u4e3aT\u7684\u7c7b\u578b)<\/li>\n\n\n\n<li>t \u4ee3\u8868\u8f6c\u6362\u540e\u7684\u53d8\u91cf<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679ci \u6ca1\u6709\u5b8c\u5168\u5b9e\u73b0T \u63a5\u53e3\u7684\u65b9\u6cd5\uff0c\u8fd9\u4e2a\u8bed\u53e5\u5c06\u4f1a\u89e6\u53d1\u5b95\u673a\u3002\u89e6\u53d1\u5b95\u673a\u4e0d\u662f\u5f88\u53cb\u597d\uff0c\u56e0\u6b64\u4e0a\u9762\u7684\u8bed\u53e5\u8fd8\u6709\u4e00\u79cd\u5199\u6cd5\uff1at,ok := i.(T)\uff0c\u8be5\u8bed\u6cd5\u8fd4\u56de\u4e24\u4e2a\u53c2\u6570\uff0c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662fi\u8f6c\u5316\u4e3aT\u7c7b\u578b\u540e\u7684\u53d8\u91cf\uff0c\u7b2c\u4e8c\u4e2a\u503c\u662f\u4e00\u4e2a\u5e03\u5c14\u503c\uff0c\u82e5\u4e3atrue\u5219\u8868\u793a\u65ad\u8a00\u6210\u529f\uff0c\u4e3afalse\u5219\u8868\u793a\u65ad\u8a00\u5931\u8d25<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"290\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/1-2.png\" alt=\"\" class=\"wp-image-6834\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/1-2.png 706w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/1-2-300x123.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/1-2-600x246.png 600w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"120\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/2-2.png\" alt=\"\" class=\"wp-image-6836\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/2-2.png 708w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/2-2-300x51.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/2-2-600x102.png 600w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u56fe\u4e2d\u7684\u4f8b\u5b50\u5982\u679c\u8981\u65ad\u8a00\u591a\u6b21\u5c31\u9700\u8981\u901a\u8fc7\u591a\u4e2aif\u6765\u5b9e\u73b0\uff0c\u66f4\u597d\u7684\u529e\u6cd5\u662f\u901a\u8fc7switch\u8bed\u53e5\u6765\u5b9e\u73b0\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"449\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/3-2.png\" alt=\"\" class=\"wp-image-6840\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/3-2.png 706w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/3-2-300x191.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/3-2-600x382.png 600w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1ax.(type)\u4e2d\u7684type\u4e3a\u56fa\u5b9a\u5199\u6cd5\uff0c\u4e0d\u80fd\u66ff\u6362\u6210\u5176\u4ed6\u5b57\u7b26<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"120\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/4-2.png\" alt=\"\" class=\"wp-image-6842\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/4-2.png 707w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/4-2-300x51.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/02\/4-2-600x102.png 600w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u56e0\u4e3a\u7a7a\u63a5\u53e3\u53ef\u4ee5\u5b58\u50a8\u4efb\u610f\u7c7b\u578b\u503c\u7684\u7279\u70b9\uff0c\u6240\u4ee5\u7a7a\u63a5\u53e3\u5728Go\u8bed\u8a00\u4e2d\u7684\u4f7f\u7528\u5341\u5206\u5e7f\u6cdb<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5173\u4e8e\u63a5\u53e3\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u53ea\u6709\u5f53\u6709\u4e24\u4e2a\u6216\u4e24\u4e2a\u4ee5\u4e0a\u7684\u5177\u4f53\u7c7b\u578b\u5fc5\u987b\u4ee5\u76f8\u540c\u7684\u65b9\u5f0f\u8fdb\u884c\u5904\u7406\u65f6\u624d\u9700\u8981\u5b9a\u4e49\u63a5\u53e3\u3002\u4e0d\u8981\u4e3a\u4e86\u63a5\u53e3\u800c\u5199\u63a5\u53e3\uff0c\u90a3\u6837\u53ea\u4f1a\u589e\u52a0\u4e0d\u5fc5\u8981\u7684\u62bd\u8c61\uff0c\u5bfc\u81f4\u4e0d\u5fc5\u8981\u7684\u8fd0\u884c\u65f6\u635f\u8017<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u6cdb\u578b\u548c\u6a21\u677f\u51fa\u73b0\u524d\uff0c\u7a7a\u63a5\u53e3\u662f\u4e00\u79cd\u975e\u5e38\u7075\u6d3b\u7684\u6570\u636e\u62bd\u8c61\u4fdd\u5b58\u548c\u4f7f\u7528\u7684\u65b9\u6cd5\u3002\u7a7a\u63a5\u53e3\u7684\u5185\u90e8\u5b9e\u73b0\u4fdd\u5b58\u4e86\u5bf9\u8c61\u7684\u7c7b\u578b\u548c\u6307\u9488\u3002\u4f7f\u7528\u7a7a\u63a5\u53e3\u4fdd\u5b58\u4e00\u4e2a\u6570\u636e\u7684\u8fc7\u7a0b\u4f1a\u6bd4\u76f4\u63a5\u7528\u6570\u636e\u5bf9\u5e94\u7c7b\u578b\u7684\u53d8\u91cf\u4fdd\u5b58\u7a0d\u6162\u3002\u56e0\u6b64\u5728\u5f00\u53d1\u4e2d\uff0c\u5e94\u5728\u9700\u8981\u7684\u5730\u65b9\u4f7f\u7528\u7a7a\u63a5\u53e3\uff0c\u800c\u4e0d\u662f\u5728\u6240\u6709\u5730\u65b9\u4f7f\u7528\u7a7a\u63a5\u53e3<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6709\u4e09\u4e2a\u64cd\u4f5c\u7b26\u53ef\u4ee5\u4f7f\u7528ok\u8fd9\u6837\u7684bool\u7c7b\u578b\u53d8\u91cf\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>v,ok := map&#91;key]   \/\/map\u6620\u5c04\nv,ok := x.T()      \/\/\u7c7b\u578b\u65ad\u8a00\nv,ok := &lt;- ch      \/\/\u901a\u9053\u63a5\u6536<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u4e5f\u662f\u4f7f\u7528\u7c7b\u578b\u65ad\u8a00\u7684\u4f8b\u5b50\uff0c\u5b9a\u4e49\u63a5\u53e3tempinter\uff0c\u63a5\u53e3\u4e2d\u5b9a\u4e49\u65b9\u6cd5hello()\uff0c\u4f46\u662f\u4e0d\u5305\u542bworld()\u65b9\u6cd5\uff0c\u7136\u540e\u5b9a\u4e49\u7ed3\u6784\u4f53aboutname\uff0c\u6b64\u7ed3\u6784\u4f53\u5b9e\u73b0\u4e86\u63a5\u53e3tempinter\uff0c\u7ed3\u6784\u4f53\u8fd8\u6709\u989d\u5916\u7684\u65b9\u6cd5world()\uff0c\u7ed3\u6784\u4f53\u7684\u65b9\u6cd5\u63a5\u6536\u5668\u4e3a\u6307\u9488\u7c7b\u578b\uff0c\u56e0\u6b64\u53ea\u80fd\u5c06\u7c7b\u578b\u7684\u6307\u9488\u4f20\u9012\u7ed9\u63a5\u53e3\u53d8\u91cf\uff0c\u7136\u540e\u8c03\u7528world\u65b9\u6cd5\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"697\" height=\"494\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/11.png\" alt=\"\" class=\"wp-image-14776\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/11.png 697w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/11-300x213.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/11-600x425.png 600w\" sizes=\"auto, (max-width: 697px) 100vw, 697px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd0\u884c\u7ed3\u679c\u62a5\u9519\uff0c\u63d0\u793a\u6ca1\u6709\u65b9\u6cd5\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"694\" height=\"102\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/12.png\" alt=\"\" class=\"wp-image-14777\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/12.png 694w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/12-300x44.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/12-600x88.png 600w\" sizes=\"auto, (max-width: 694px) 100vw, 694px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4fee\u6539\u4e0a\u9762\u7684\u4ee3\u7801\uff0c\u589e\u52a0\u7c7b\u578b\u65ad\u8a00\uff0c\u7136\u540e\u518d\u6b21\u8c03\u7528world\u65b9\u6cd5\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"694\" height=\"518\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/1-6.png\" alt=\"\" class=\"wp-image-14778\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/1-6.png 694w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/1-6-300x224.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/1-6-600x448.png 600w\" sizes=\"auto, (max-width: 694px) 100vw, 694px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u7a0b\u5e8f\u8fd0\u884c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"699\" height=\"98\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/2-5.png\" alt=\"\" class=\"wp-image-14779\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/2-5.png 699w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/2-5-300x42.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/09\/2-5-600x84.png 600w\" sizes=\"auto, (max-width: 699px) 100vw, 699px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u56fe\u4e2d\u7684\u7c7b\u578b\u65ad\u8a00\u53ef\u4ee5\u7406\u89e3\u4e3a\u4ece\u63a5\u53e3\u53d8\u91cftp\u4e2d\u53d6\u56de\u6765\u7c7b\u578baboutname\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u8c03\u7528world\u65b9\u6cd5<\/p>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1a\u5982\u679c\u4e00\u4e2a\u7c7b\u578b\u58f0\u660e\u4e86\u6307\u9488\u63a5\u6536\u5668\u65b9\u6cd5\uff0c\u4f60\u5c31\u53ea\u80fd\u5c06\u90a3\u4e2a\u7c7b\u578b\u7684\u6307\u9488\u4f20\u9012\u7ed9\u63a5\u53e3\u53d8\u91cf<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">8\u3001\u6bd4\u8f83\u7a7a\u63a5\u53e3\u4fdd\u5b58\u7684\u503c<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f53\u7a7a\u63a5\u53e3\u7c7b\u578b\u662f\u57fa\u7840\u7c7b\u578b\u3001\u6570\u7ec4\u7c7b\u578b\u6216\u7ed3\u6784\u4f53\u7c7b\u578b\u65f6\uff0c\u4e0d\u8bba\u7a7a\u63a5\u53e3\u7684\u7c7b\u578b\u662f\u5426\u76f8\u540c\uff0c\u90fd\u53ef\u4ee5\u4f7f\u7528&#8221;==&#8221;\u6bd4\u8f83\u7a7a\u63a5\u53e3\u4fdd\u5b58\u7684\u503c<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"650\" height=\"290\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/5-2.png\" alt=\"\" class=\"wp-image-18147\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/5-2.png 650w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/5-2-300x134.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/5-2-600x268.png 600w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"648\" height=\"98\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/6-2.png\" alt=\"\" class=\"wp-image-18148\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/6-2.png 648w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/6-2-300x45.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/6-2-600x91.png 600w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u7a7a\u63a5\u53e3\u7c7b\u578b\u662f\u5207\u7247\u7c7b\u578b\u6216\u6620\u5c04\u7c7b\u578b\uff0c\u5219\u65e0\u6cd5\u6bd4\u8f83\u7a7a\u63a5\u53e3\u4fdd\u5b58\u7684\u503c\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"651\" height=\"275\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/7-1.png\" alt=\"\" class=\"wp-image-18150\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/7-1.png 651w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/7-1-300x127.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/7-1-600x253.png 600w\" sizes=\"auto, (max-width: 651px) 100vw, 651px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u63d0\u793a\u5207\u7247\u53ea\u80fd\u4e0enil\u8fdb\u884c\u6bd4\u8f83\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"649\" height=\"95\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/8-1.png\" alt=\"\" class=\"wp-image-18151\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/8-1.png 649w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/8-1-300x44.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2025\/05\/8-1-600x88.png 600w\" sizes=\"auto, (max-width: 649px) 100vw, 649px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u63a5\u53e3\u672c\u8eab\u662f\u8c03\u7528\u65b9\u548c\u5b9e\u73b0\u65b9\u5747\u9700\u8981\u9075\u5b88\u7684\u4e00\u79cd\u534f\u8bae\uff0c\u5927\u5bb6\u6309\u7167\u7edf\u4e00\u7684\u65b9\u6cd5\u547d\u540d\u53c2\u6570\u7c7b\u578b\u548c\u6570\u91cf\u6765\u534f\u8c03\u903b\u8f91\u5904\u7406\u7684\u8fc7\u7a0b\u3002 Go [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":3902,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[111,23],"tags":[],"class_list":["post-3402","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-go","category-rong"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/3402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/comments?post=3402"}],"version-history":[{"count":93,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/3402\/revisions"}],"predecessor-version":[{"id":18152,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/3402\/revisions\/18152"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/3902"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=3402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=3402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=3402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}