{"id":199712,"date":"2020-11-06T07:08:00","date_gmt":"2020-11-05T23:08:00","guid":{"rendered":"http:\/\/4563.org\/?p=199712"},"modified":"2020-11-06T07:08:00","modified_gmt":"2020-11-05T23:08:00","slug":"golang-%e5%85%b3%e4%ba%8e-nil-%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=199712","title":{"rendered":"golang \u5173\u4e8e nil \u7684\u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  golang \u5173\u4e8e nil \u7684\u95ee\u9898               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Chaox <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>nil \u7684\u5e95\u5c42\u5b9e\u73b0\u5728\u6e90\u7801\u4e2d\u4e3a\uff1a<\/p>\n<pre><code>\/\/ nil is a predeclared identifier representing the zero value for a \/\/ pointer, channel, func, interface, map, or slice type. var nil Type \/\/ Type must be a pointer, channel, func, interface, map, or slice type  \/\/ Type is here for the purposes of documentation only. It is a stand-in \/\/ for any Go type, but represents the same type for any given function \/\/ invocation. type Type int  <\/code><\/pre>\n<p>\u5728\u6e90\u7801\u4e2d\u597d\u50cf\u662f int \u7c7b\u578b\uff1f \u6211\u7684\u7591\u60d1\u662f nil \u5728\u5b9e\u9645\u4f7f\u7528\u4e2d\u662f\u6709\u7c7b\u578b\u533a\u5206\u7684\uff0c\u53ef\u4ee5\u628a nil \u8f6c\u6362\u4e3a\u4e0d\u540c\u7c7b\u578b\u7684 nil \u3002\u90a3 nil \u662f\u63a5\u53e3\u7c7b\u578b\u8fd8\u662f int \u7c7b\u578b\uff1f \u5982\u679c\u63a5\u53e3\u7c7b\u578b\u4ed6\u7684 data\uff0ctype \u662f\u4ec0\u4e48\u5185\u5bb9\u5462\uff1f\u5982\u679c\u662f int \u7c7b\u578b\u5e95\u5c42\u5b9e\u73b0\u53c8\u662f\u5982\u4f55\u5462\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>2<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4261543\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : darksword21 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u597d\u95ee\u9898\uff0c\u4e0b\u56de\u7b54                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4261544\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : elechi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7406\u89e3\u6210\u7a7a\u6307\u9488\u5c31\u884c<br \/>\/\/ Type must be a pointer, channel, func, interface, map, or slice type<br \/>\u5bf9\u5e94\u7684\uff0c\u4e0a\u9762\u8fd9\u4e9b\u5176\u5b9e\u90fd\u662f\u6307\u9488\u7c7b\u578b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>golang \u5173\u4e8e nil \u7684\u95ee\u9898&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/199712"}],"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=199712"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/199712\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=199712"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=199712"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=199712"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}