Noopher: Is there any good resource for learning about Writer and Reader?

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

A noob gopher here. It seems that Reader and Writer are a huge part of golang language. Especially when it comes to terminal user input. However, coming from (very basic) Python, user interaction through terminal is giving me headaches. And the Reader/Writer interfaces are right in the middle of all of this.

So far I've been resorting to the monkey-see-monkey-do strategy, but I'd really like to be able to understand what I'm actually doing with those NewWriter calls.

Is there a good resource or post to read up on that?

Thank you in advance!


评论:

DoomFrog666:

If you look at their implementation you see they have just one method each. This is what makes them so powerful it's the best abstraction you can get.

Familiarize yourself with the standard library and write small cli tools.

One of the most important types in the standard library implementing Reader/Writer are *os.File and bytes.Buffer. Take also a look at io/ioutil and os.Stdin/out.


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

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