Book Review: The Go Programming Language

Reading time: 4 minutes
null

[Disclaimer: I was provided with a free review copy by the publisher.]

tl;dr 🔗︎

If you’re looking to buy a comprehensive text on Go, “The Go Programming Language” is an excellent choice. But with so many free e-book introductions to Go, do you really need it? Maybe, but maybe not.

Overview 🔗︎

The authors “assume that you have programmed in one or more other languages” and thus “won’t spell out everything as if for a total beginner”. Yet the book weighs in at a hefty 380 pages (over 100 pages more than my venerable 1988 K&R 2nd edition).

Is it better than the free 50-page “Little Go Book”, or the free 160-page “Introduction to Programming in Go” or even the freely-available 80-page Go Language Specification itself? Yes, certainly. But is it two or three or four times as good? I don’t think so.

So is “The Go Programming Language” worth the cost to read in both dollars *and* time? It depends on how you learn, how much you already know, and whether, for you, the good parts outweigh the bad.

The Good Parts 🔗︎

Chapter 1 (“Tutorial”) sets the stage for much of what is excellent about this book: fabulous examples. Beyond the obligatory “Hello World”, it presents a quick look at several simplified “real world” examples, including command line text filtering, image generation/animation, URL fetching and serving a web page.

The rest of the book follows this same pattern. Chapters typically present several different code examples, most of which do real things rather than just consist of toy code. They include exercises (which I didn’t do), that would be good for a course or for someone who learns best by doing structured exercises. The examples are enough to serve as a starting “cookbook” for many real-world tasks.

I also found the explanations of struct embedding and composition to be excellent. Some concepts gelled much better for me than they had from other texts and even from my own coding to date. I had the same experience in the chapter on concurrency with channels. I was pleased that things so idiosyncratic to Go were some of the best parts of the book.

The Bad Parts 🔗︎

Sadly, the book’s coverage of the standard library is haphazard. On the one hand, the many real world code examples gave opportunities to introduce parts of the standard library naturally throughout. Unfortunately, that also means there’s no comprehensive coverage of the standard library itself, which is surprising given that it’s one of great strengths of the language.

The most glaring example of this ad hoc approach was finding a section on text and HTML templating oddly dropped in at the end of Chapter 4 (“Composite Types”). It was as if they really wanted to cover those packages and – without a chapter dedicated to the standard library – had nowhere else to put it.

As mentioned previously, the book is long and rather dense. It’s not a quick read. Worse, the authors have a habit of burying important points or cautions in the middle of a wall of text and code examples. The lack of cutesy caution icons or call-out boxes for these tidbits (as would be found in more informally-styled books) really hurts skim-ability.

The Mixed Parts 🔗︎

As great as the examples were, I found some aspects disturbing. First, in some cases, implementation details were omitted from the text – the reader is expected to download the source to see the full example. I would have preferred complete, if less ambitious, examples instead.

In other cases – particularly in the sections on concurrency – the examples are presented in a progression of one or more complete “wrong” examples of how not to do things before an example of the “right” way to do things. This approach is a good teaching method, but it adds substantially to the length of the text – you have to grok a lot more code to parse out the differences between the examples.

The other interesting observation I had was that in many cases, the examples omit error handling for brevity. Since the verbosity of Go code error handling is a frequent criticism of the language, omitting it seemed somehow disingenuous.

Summary 🔗︎

If you have the money and patience and you like deep dives and real, working examples and exercises, this book is an excellent choice. If you prefer to skim or dabble, or just want a handy reference text, there are probably better options.

•      â€¢      â€¢

If you enjoyed this or have feedback, please let me know by or