violetear using net/context on a custom response_writer

agolangf · · 362 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I was asked for a way to share data between handlers beside getting the named params, so for doing I decided to use the net/context package, but I need help to check if is OK how I am doing the implementation or if I am missing something, the code here: <a href="https://github.com/nbari/violetear/blob/master/response_writer.go#L14" rel="nofollow">https://github.com/nbari/violetear/blob/master/response_writer.go#L14</a>, the docs here (at the bottom) <a href="http://www.violetear.org" rel="nofollow">www.violetear.org</a>.</p> <p>I am trying to keep the implementation as clean has posible and to be compliant with the net/http packages, the cost I have to pay for this is an type assertion,: <a href="https://github.com/nbari/violetear/blob/master/violetear_test.go#L412" rel="nofollow">https://github.com/nbari/violetear/blob/master/violetear_test.go#L412</a> some say assertions are not good others that is not a problem, I just wonder what is wrong with the assertion.</p> <p>regards.</p>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

362 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传