xix
Introduction
Go, also commonly referred to as Golang, is a general-purpose programming language conceived at Google
in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. The language first appeared in November 2009
as an open source project. The Go open source project is available at
https://github.com/golang/go .
Version 1.0 of Go was released in March 2012, providing a stable version that includes language
specification, standard libraries, and custom tools. Go borrows the basic syntax of C and has the same
philosophy as C: Enable maximum capability with a minimum set of features. You can say that Go is a
modern C with the productivity of a dynamically typed language, although it is a statically typed language.
The Go web site (
https://golang.org/ ) defines Go this way: “Go is an open source programming language
that makes it easy to build simple, reliable, and efficient software.”
When Go was conceived at Google, there were numerous challenges in the software engineering of
systems. Many of our software systems were not able to leverage the emergence of multicore computers.
Our modern computers now have evolved to include many CPU cores and we are still using the languages
and tools that were designed to write software for single-core machines. There was an emergence of the
use of dynamically typed language for the sake of productivity, but it causes performance problems when
applications are scaling, and debugging those applications is extremely difficult. C and C++ were widely
used for writing systems software, but compiling larger applications with C and C++ was always painful due
to the time-consuming compilation process. Another challenge is that we have many existing programming
languages, but we use different languages for different purposes. For example, we might use C and C++ for
writing high-performance systems software, but we use a different language for writing web applications.
Using different programming languages for each techncial domain is really painful for many organizations,
especially startup organizations.
First and foremost, Go is a great general-purpose programming language, designed to be simple,
minimal, pragmatic. Go is a compiled, concurrent, garbage-collected, statically typed language that lets you
write high-performance, scalable systems with high productivity. Go is efficient, scalable, and productive.
Go compiles programs quickly into native machine code. It will surprise you with its simplicity and
pragmatism. Go is designed for solving real-world problems rather than focusing too much on academic
theories and programming language theory (PLT). Concurrency is a built-in feature of Go that enables you
write efficient, high-performance software systems by leveraging the power of modern computers that have
many CPU cores. Although Go is a statically typed language, it provides the productivity of a dynamically
typed language thanks to its pragmatic design. As a general-purpose programming language, Go can be used
for building a variety of software systems.
The book provides a problem-solution approach with various code recipes. Each recipe is a self-contained
solution to a practical programming problem in Go. The first four chapters of the book are focused on the
Go programming language and its various features. The remaining chapters help you to build real-world
applications.
The source code for the book is available on GitHub at
https://github.com/shijuvar/go-recipes .
This will provide source code for each recipe discussed in the book. This GitHub repository will also provide
additional example code that is not presented in the book.