Programming in Go Summerfield, Mark English Addison-Wesley 2014 9780321774637 A textbook teaching how to program in Go. https://www.qtrac.eu/gobook.html Programming in Go Book InStock

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 ordered from amazon (#ad) 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 2016-02-18] and have been tested with Go 1.0–Go 1.7—they are subject to the very liberal Apache 2.0 license. There is also an Errata [updated 2014-11-08].

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

Tables

Introduction Why Go? The Structure of the Book Acknowledgements

Chapter 1. An Overview in Five Examples— This is available as a sample chapter—click "Sample Content" and then "Download the sample pages". Getting Going Editing, Compiling, and Running Hello Who? Big Digits—Two-dimensional Slices Stack—Custom Types with Methods Americanise—Files, Maps, and Closures Polar to Cartesian—Concurrency

Chapter 2. Booleans and Numbers Preliminaries Boolean Values and Expressions Numeric Types Example: Statistics

Chapter 3. Strings Literals, Operators, and Escapes Comparing Strings Characters and Strings Indexing and Slicing Strings String Formatting with the Fmt Package Other String-Related Packages Example: M3u2pls

Chapter 4. Collection Types Values, Pointers, and Reference Types Arrays and Slices Maps Examples: Guess Separator Word Frequencies

Chapter 5. Procedural Programming Statement Basics Branching Looping with For Statements Communication and Concurrency Statements Defer, Panic, and Recover Custom Functions Example: Indent Sort

Chapter 6. Object Oriented Programming Key Concepts Custom Types Interfaces Structs Examples: FuzzyBool Shapes Ordered Map

Chapter 7. Concurrent Programming Key Concepts Examples: Filter Concurrent Grep Thread-Safe Map Apache Report Find Duplicates

Chapter 8. File Handling Custom Data Files Handling JSON Files Handling XML Files Handling Plain Text Files Handling Go Binary Files Handling Custom Binary Files Example: Invoicedata Compressed and Archive Files Handling ZIP Files Handling Tar Files Examples: Pack Unpack

Chapter 9. Packages Custom Packages Creating Custom Packages Importing Packages Third-Party Packages A Brief Survey of Go's Commands A Brief Survey of the Go Standard Library

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 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.

Your Privacy • Copyright © 2006 Qtrac Ltd. All Rights Reserved.

Top