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.
