{"id":156304,"date":"2020-09-17T11:54:55","date_gmt":"2020-09-17T03:54:55","guid":{"rendered":"http:\/\/4563.org\/?p=156304"},"modified":"2020-09-17T11:54:55","modified_gmt":"2020-09-17T03:54:55","slug":"golang-%e9%87%8c%e9%9d%a2%e5%85%a8%e5%b1%80%e5%8c%bf%e5%90%8d%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e6%98%af%e5%95%a5%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=156304","title":{"rendered":"golang \u91cc\u9762\u5168\u5c40\u533f\u540d\u53d8\u91cf\u7684\u4f5c\u7528\u662f\u5565\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  golang \u91cc\u9762\u5168\u5c40\u533f\u540d\u53d8\u91cf\u7684\u4f5c\u7528\u662f\u5565\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : iCD <\/span>  <span><i><\/i> 6<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u770b\u5230\u8fc7\u597d\u51e0\u6b21\u522b\u4eba\u7684\u4ee3\u7801\u91cc\u9762\u90fd\u6709\u5168\u5c40\u7684\u533f\u540d\u53d8\u91cf\uff0c\u6bd4\u5982\u8fd9\u91cc\uff1a<\/p>\n<pre><code>...  type cachedWriter struct {  gin.ResponseWriter  status  int  written bool  store   persistence.CacheStore  expire  time.Duration  key     string }  var _ gin.ResponseWriter = &amp;cachedWriter{} ...  <\/code><\/pre>\n<p>\u4ee3\u7801\u5730\u5740\uff1ahttps:\/\/github.com\/gin-contrib\/cache\/blob\/master\/cache.go#L45<\/p>\n<p>\u8fd9\u91cc <code>var _ gin.ResponseWriter = &amp;cachedWriter{}<\/code> \u8fd9\u6837\u5199\u662f\u4e3a\u4e86\u5565\uff0c\u6ca1\u770b\u660e\u767d\uff0c\u6c42\u8d50\u6559~<\/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=\"3267843\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : imgk <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u786e\u5b9a cacheWriter \u5b9e\u73b0\u63a5\u53e3                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3267844\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zengming00 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             &#8220;`go<br \/>type myInterface interface {<br \/> foo()<br \/>}<\/p>\n<p>type myData struct{}<\/p>\n<p>func (o *myData) foo() {<br \/>}<\/p>\n<p>var _ myInterface = &amp;myData{}<\/p>\n<p>&#8220;`<br \/>1 \u8bf4\u5f97\u5bf9\uff0c\u5982\u679c\u6ca1\u6709\u5b9e\u73b0 myInterface \u63a5\u53e3\uff0c\u90a3\u4e48\u5728\u7f16\u8bd1\u9636\u6bb5\u5c31\u4f1a\u62a5\u9519                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3267845\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : iCD <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u539f\u6765\u5982\u6b64\uff0c\u6211\u5b66\u4f1a\u4e86\uff01                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3267846\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : useben <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5728\u633a\u591a\u5f00\u6e90\u6846\u67b6\u89c1\u5230, \u786e\u5b9e\u6280\u5de7\u4e86. \u4e0d\u8fc7\u7528 goland \u7684\u8bdd, \u53ef\u4ee5\u4e00\u952e\u67d0\u7ed3\u6784\u5b9e\u73b0\u67d0\u63a5\u53e3, \u53ef\u4ee5\u907f\u514d\u8fd9\u6837\u7684\u68c0\u9a8c\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3267847\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : weakish <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             golang FAQ \u91cc\u6709\u5199\uff1a https:\/\/golang.org\/doc\/faq#guarantee_satisfies_interface                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3267848\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : githubhaoliu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd8\u6709\u4e00\u4e9b\u662f\u4e3a\u4e86\u8df3\u8fc7 unused \u68c0\u6d4b\uff0c\u6bd4\u5982<\/p>\n<p>var _ = xxx                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3267849\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : buzz2d0 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5b66\u4e60\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3267850\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : securityCoding <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5b66\u4e60\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>golang \u91cc\u9762\u5168\u5c40\u533f\u540d\u53d8\u91cf\u7684\u4f5c&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\/156304"}],"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=156304"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/156304\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=156304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=156304"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=156304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}