Book Review: Go by Example

Book Review: Go by Example

Each year, I try to learn to use another computer language. It’s not that I want to be proficient in them all, but I’d like to understand them, so that when I’m part of a project that uses them, I can make sensible contributions. The latest language for me was Go. I bought a copy of Go by Example: Programmer’s guide to idiomatic and testable code from Manning.

Author

I had not come across Inanc Gumus before but according to the book, Inanc is a programmer and passionate educator with decades of experience in software engineering. Importantly, he has specialized in Go since 2012.

Go by Example

Learning the syntax of a programming language is usually the easy part. Learning how experienced developers expect you to use it is much harder. That’s why I like to read a book like this. It isn’t really a book about memorizing Go keywords. It’s about learning to write Go code that is simple, testable, and easy for someone else to maintain.

Inanc makes his position pretty clear in the preface. When his team first adopted Go, they brought familiar object-oriented habits with them and ended up with a complicated system full of unnecessary abstractions. Much of the program had to be rewritten. That experience shapes the whole book: don’t fight the language, and don’t design layers of complexity for problems you haven’t encountered yet.

I like the way the book worked through connected, realistic examples instead of presenting hundreds of unrelated snippets. You build command-line tools, an HTTP client, and server-side components, gradually improving their design as new requirements appear. The examples are small enough to follow, but they deal with issues that matter in real software. There’s a GitHub repository containing the code, and exercises encourage readers to try things rather than just read about them.

I particularly liked how early the book introduces testing. Many programming books leave it until the final chapters, like it’s some sort of afterthought. I used to think it was disappointing that years ago, one of the things left out of the lower editions of Microsoft Visual Studio was testing. That should be in every edition.

The chapters cover table-driven tests, subtests, example tests, coverage, benchmarks, and profiling. One of my favourite examples demonstrates that even 100 percent test coverage can miss a bug in a URL parser. Nice! A test that executes a line of code isn’t necessarily a test that checks the right behavior.

Another strong point is the discussion on dependency injection. Instead of introducing a complicated framework, Inanc shows how everyday Go features, including interfaces and io.Writer, can make code easier to test. I like the emphasis on keeping dependencies visible and designing around what the code actually needs. Developers arriving from other languages may initially find this approach too simple, but that’s rather the point.

The concurrency chapters are probably where the book becomes most interesting, at least to me, and also most demanding. I remember Dr Jim Gray once telling me that there are three phases people go through with concurrent or parallel code. The first is where it all looks like magic. The second is the scary part, where you think you understand it. And the third is when you get wise and realize it was actually much harder than you thought it was.

Goroutines and channels are attractive features of Go, but it’s easy to write concurrent code that is difficult to control. The book develops a pipeline for making multiple requests, then returns to it to deal with cancellation, resource leaks, efficient I/O, and HTTP testing. I particularly appreciated that Inanc doesn’t stop when the program appears to work. He shows why a seemingly reasonable design can leave goroutines running after the caller has stopped listening.

The later material on package structure, HTTP handlers, middleware, and SQL storage is equally practical. The discussion of implicit interfaces and composition is useful because it encourages readers to build flexible software without automatically creating large hierarchies of types. I also like that the standard library is treated as a serious first choice rather than something to replace with third-party packages as quickly as possible.

Limitations?

I do have a few reservations. Despite its approachable title, this isn’t an ideal first programming book, or even necessarily the easiest introduction to Go. It assumes you already understand programming, and pretty thoroughly. Some sections move pretty quickly into fairly subtle design decisions. The appendices explain language fundamentals, but I suspect a complete beginner would be better served by a more conventional introduction first.

The project-based structure also means the book asks for commitment. You really need to follow the code as it evolves; dipping into a later chapter without the earlier context may be frustrating. And because so much of the book revolves around command-line tools, networking, and services, readers interested in other kinds of Go applications may find the coverage narrower than they expected.

I also think the focus on idiomatic Go can sometimes sound more definite than software design deserves. Simple code is a worthy goal, but there are usually several reasonable ways to solve a problem. Fortunately, the author generally treats his recommendations as guidelines rather than universal laws.

Summary

I strongly recommend Go by Example to developers who already know how to program and want to become better at Go. Its real strength isn’t teaching syntax; it’s showing how testing, composition, concurrency, and careful design fit together. I came away thinking that the book’s lessons about resisting unnecessary complexity are valuable even if you never write another line of Go.

8 out of 10

2026-12-01