3 ms·
>> I'm always saying that good way to learn language patterns and idioms is to look into standard libraries implementations. > >Why would that be true? This is
by beautron 3y ago
>> I'm always saying that good way to learn language patterns and idioms is to look into standard libraries implementations.
>
>Why would that be true?
This isn't always true, and can't be generally expected, but I think it is true in the case of Go's standard libraries. These are high quality, and are one of my top examples of good, real source code to study (along with the DOOM and Quake source code). A nice touch in Go's library documentation is that you can click any API element (type, function, etc.) to be brought directly to its source code.
Yes, there are differences between writing libraries and writing programs. But there is value in studying well-written source code, even when it has concerns and requirements that differ from yours. You can adapt what you learn to your needs.