WriteSeeker on a slice

agolangf · 2017-10-11 22:30:06 · 479 次点击    
这是一个分享于 2017-10-11 22:30:06 的资源,其中的信息可能已经有所发展或是发生改变。

The other day I was messing around with go-audio/wav which expects an io.WriteSeeker. Unwilling to use an os.File and an unfruitful attempt to use mattetti/filebuffer I ended up implementing the io.WriteSeeker interface on a slice: corticph/slicewriteseek Feedback welcome!


评论:

jrwren:

Its fine, but pointless as bytes.Buffer is in the standard library.

glaslos:

bytes.Buffer does not implement io.WriteSeeker

jrwren:

TIL.

nhooyr:

https://github.com/golang/go/issues/21592

glaslos:

Thanks for the link. The issue references https://github.com/orcaman/writerseeker which is very similar to my implementation except the Read() method doesn't update the position.


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

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