
First, I will briefly go over the structure of the book chapter by chapter, then provide a conclusion, along with a list of the book’s pros and cons.
Textbook
This is an introductory chapter on working with the Go language. It covers the language’s origins, presents a “hello world” example, discusses execution and compilation, the concept of modules (packages), function declarations, code formatting, working with command-line arguments, variable declarations, and a brief introduction to `for`. It also covers finding duplicate lines in several ways, working with images and URLs, and even creating a basic web server.
Program Structure
This chapter discusses reserved keywords, naming conventions for variables, functions, and constants. It explains how to declare variables (via var, const, type, func), which parts can be omitted, and how to group multiple declarations. Pointers and variable creation using the `new` function are thoroughly explained. Topics such as variable lifetimes and scopes, as well as value assignments, are addressed. The chapter also demonstrates using external packages, importing, and data encapsulation.
Basic Data Types
This section covers numbers (integers, floating point), binary and bitwise operators and their precedence, number comparisons. It describes working with complex numbers in Go and boolean values. Strings, escape sequences, string literals, and runes (for working with Unicode characters) are discussed. Examples of converting strings to numbers and back are provided. Constants and pseudo-enums are also explored.
Composite Data Types
This chapter focuses on more complex types: arrays (fixed-length sequences), slices (dynamic sequences), maps (key-value collections), and structs. It covers creation, initialization, comparison, and main functions for working with arrays and slices. Several examples of working with maps are given. Structs are thoroughly explained, including JSON handling and the use of `Marshal` and `Unmarshal`. It ends with an example of working with HTML using Go.
Functions
This is a fairly detailed section on functions. It begins with theory, followed by an example of recursive HTML processing. It discusses multiple return values and one of Go’s key concepts — error checking using `if err != nil`. Anonymous functions and variadic functions (accepting a variable number of parameters) are covered in depth.
Methods
Since Go does not have the classic OOP model familiar to many, working with objects is done through structs and methods (functions associated with structs). It touches on encapsulation and shows how the same task can be implemented using either a regular function or a method.
Interfaces
A chapter about creating and using interfaces. It starts with the theoretical part, explaining the purpose of interfaces and how they are implemented. Among the standard interfaces, those for sorting, working with web servers, and error handling are reviewed. Topics like type declarations and panic handling are also covered. If JSON was discussed earlier, here you’ll find an example of working with XML.
Go Routines and Channels. Concurrency
Two chapters are devoted to concurrent programming. The first focuses on theory and examples, including one of Go’s fundamental topics — channels (including buffered and unidirectional ones) and the `select` statement.
The second chapter contains fewer examples, but emphasizes problems that may arise with concurrent execution (e.g., race conditions) and their solutions (using `sync.Mutex` and `sync.RWMutex`).
Go Packages and Tools
Although the reader is already familiar with the concept of packages and modules, this chapter dives deeper. It covers imports in detail and emphasizes that third-party libraries can be used, not just the standard library.
The second part of the chapter is dedicated to Go tools: compilation, installing packages and dependencies, testing, and much more. It also describes workspace organization and directory structure.
Testing
One of the final chapters is about code testing using Go’s built-in tool (`go test`), briefly mentioned in the previous chapter. Third-party testing libraries are also mentioned. Otherwise, the chapter is standard: why tests are needed, how to write them correctly or incorrectly, fragile tests, test coverage, and more.
Reflection and Low-Level Programming
The final two and shortest chapters are aimed at more experienced developers. The first covers reflection — for example, if you need to create your own static analyzer or code analysis tool. The second is about low-level programming — when Go’s capabilities are not enough and you need to use C libraries or OS calls.
Conclusion
Who is this book for?
This book is suitable both for those who are new to the language and for those who have been working with Go for several years and want to systematize, reinforce, and deepen their knowledge.
Pros:
- Easy and clear to read.
- Clear structure: each chapter logically follows the previous one.
- Plenty of code examples.
- Practical exercises after each chapter.
Cons:
- Not sure if the book has been updated, but at the time of reading it didn’t cover some of Go’s newer features, such as generics.
- The book is over 400 pages long, which might be a barrier for those not used to reading technical literature of such volume.