Programming in Go

Creating Applications for the 21st Century
by Mark Summerfield

ISBN-10: 0321774639 – ISBN-13: 978-0321774637

Chapter 1 is available free from InformIT—click "Sample Content" and then "Download the sample pages" (PDF 6.5MB). I've also done some short videos on Go.

The purpose of this book is to teach solid idiomatic Go programming using all the features the language provides, as well as the most commonly used Go packages, and also to serve as a useful reference once the language is learned. The reader is assumed to have programming experience in a mainstream programming language such as C, C++, Java, Python, or similar, although all of Go's unique features and idioms are illustrated with complete runnable examples that are fully explained in the text.

Go runs on most Unix-like operating systems such as Linux and Mac OS X, and also on Windows. The book's text is completely compliant with Go 1. All the examples and exercise solutions build with all Go 1.x releases on Linux, Mac OS X, and Windows.

The book will be useful to people who program professionally as part of their job, whether as full-time software developers, or those from other disciplines, including scientists and engineers, who need to do some programming in support of their work. It will also be useful to students who have had a reasonable amount of programming experience.

Go provides high level features such as slices (in effect variable length arrays) and maps (hash tables). Go can be used for procedural and object-oriented programming (or a combination of both). Go's approach to object orientation is unusual being based on aggregation and delegation, interfaces, and duck typing, rather than inheritance and virtual (overridable) methods. Go has a garbage collector to relieve programmers from the burdens of manual memory management. Built into the Go language is support for a version of CSP (Concurrent Sequential Processes) using channels that makes writing concurrent programs a lot easier than the traditional threading approaches—it is perfectly possible to write highly concurrent Go programs that contain no explicit locks at all.

Arguably, C++, Objective-C, and Java (the latter indirectly as a “better C++”), have all attempted to be better C's. Go can also be seen as an attempt to be a better C, even though Go's clean light syntax is reminiscent of Python—and Go's slices and maps are very similar to Python's lists and dicts. However, Go is probably closer in spirit to C than to any other language, and can be seen as an attempt to avoid all of C's drawbacks while providing all that's best in C, as well as its own powerful and useful features.

The book has benefited enormously from technical reviews by a couple of expert Go programmers—and from feedback from some non-Go programmers to ensure that the book teaches everything it should and is understandable to those new to Go.

The book is 496 pages, and is published by Addison-Wesley Professional. It can be bought from most online or local book stores.

Only the English printed editions are definitive—although available in electronic formats, "ebooks" usually restrict your rights, and they are often retypeset which can introduce errors. A legal PDF version is available from InformIT. Translations are arranged by the publisher and their quality can vary considerably.

Downloads

In view of the EU’s Cyber Resilience Act and an abundance of caution, we have withdrawn all our free software, including our book examples.

Table of Contents—most chapters also have at least one exercise

Programming in Go book cover

Reviews

Translations

Translations are arranged by the publisher and their quality can vary considerably. Only English print editions are definitive.

A Russian translation is due to be published in late 2013.

This web page has been translated by third-parties over whom we have no control into: Armenian, Belarusian, Dutch, French, German, Greek, Serbo-Croatian, Spanish, and Ukrainian.


For more about Go see golang.org.

Like all my books and most of my other writings, this book was written using The Lout Typesetting System.

Top