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 Go 1.0, 1.1, and 1.2 on Linux, Mac OS X, and Windows and should work with all Go 1.x releases.

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 ordered from Amazon.com, Amazon.co.uk, or from your preferred online or local book store. (A small batch of books was printed with one 16-page sheet missing—pages 401-416. Please check that these pages are present if buying in a book store. If you buy online and these pages are missing, go through the returns process for a free replacement.)

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

The source code is available in two formats, gobook-1.0.tar.gz (70K suitable for any platform), and gobook-1.0.zip (170K Windows line endings) [updated 2013-10-09] and have been tested with Go 1.0, Go 1.1, and Go 1.2—they are subject to the very liberal Apache 2.0 license. There is also an Errata [updated 2013-06-28].

Programming in Go book cover

Reviews

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

  • Chapter 9. Packages
  • Appendix A: Epilogue
  • Appendix B: The Dangers of Software Patents
  • Appendix C: Selected Bibliograpy
  • Index
  • 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 into Serbo-Croatian.


    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