Go in Practice
Go in Practice
Summary:
Introduction
The book "Go in Practice" (authors — Matt Butcher and Matt Farina, published in 2016) holds a special place among literature on the Go programming language. Unlike many textbooks that start with syntax and theory, this book immediately immerses the reader in solving real-world problems. It is intended for those who are already familiar with the basics of Go (or another C-like language) and want to learn how to apply the language in everyday development — from working with HTTP servers to testing and deployment.
What the book is about
"Go in Practice" consists of 8 parts, each dedicated to a specific area of Go application. The authors do not waste time explaining basic syntax — they immediately move on to practical techniques. The book covers:
- Working with the command line — flags, arguments, configuration files.
- HTTP servers and clients — routing, middleware, working with JSON, REST API.
- Databases — connecting to SQL and NoSQL, connection pools, transactions.
- Testing — unit tests, table-driven tests, mocks, benchmarks.
- Concurrency — goroutines, channels, concurrency patterns, sync.WaitGroup.
- Packaging and deployment — building, dependencies, Docker, CI/CD.
- Security — encryption, authentication, protection against injections.
Who this book is for
The book is aimed at practicing developers who have already written at least a few programs in Go and want to deepen their knowledge. It will be useful for:
- Developers transitioning from other languages (Python, Java, C#) to Go.
- Engineers who want to master idiomatic Go and best practices.
- Team leads and architects looking for proven recipes for building reliable services.
What the reader will learn
After reading the book, you will be able to:
- Design and implement HTTP servers with proper error handling.
- Work with databases using the standard database/sql package.
- Write clean and efficient tests using the built-in testing package.
- Use goroutines and channels to create concurrent programs without data races.
- Configure building and deployment of Go applications in containers.
- Apply design patterns characteristic of Go (e.g., functional options, middleware).
Strengths
The main advantage of the book is its practical focus. Each chapter contains code examples that can be immediately applied in a real project. The authors not only show how a particular function works but also explain why a particular approach should be chosen. For example, in the testing section, they demonstrate how to write table-driven tests and use httptest to test HTTP handlers — these are the skills that are truly needed in production.
Another plus is the emphasis on idiomaticity. The book teaches you to write code in the Go style, avoiding unnecessary complexity. The authors show how to use interfaces to create flexible abstractions and warn against typical beginner mistakes (e.g., incorrect use of goroutines).
The section on deployment deserves special mention. In 2016, the topic of containerization was just gaining momentum, but the authors already included examples with Docker and a discussion of CI/CD. This makes the book relevant even years later.
Who it is recommended for
I recommend "Go in Practice" to everyone who has already mastered the basics of Go and wants to move on to creating full-fledged applications. The book will be especially useful for those who:
- Write microservices or web services in Go.
- Work on automation and command-line tools.
- Want to learn how to test Go code correctly and efficiently.
If you are just starting to learn Go from scratch, it is better to first read "The Go Programming Language" or the official documentation.