Go is a compiled, statically typed programming language that makes it easy to build simple, reliable, and efficient software. It’s a general purpose programming language with modern features, clean syntax and a robust well-documented common library, making it a good candidate to learn as your first programming language. While it borrows ideas from other languages such as Algol and C, it has a very different character. It’s sometimes described as a simple language.
Go is an open source project developed by a team at Google and many contributors from the open source community. Go’s first release was in 2009, and it’s distributed under a BSD-style license.
This article selects the best open source books that will give readers a firm foundation in developing Go applications. There are also some books included that aren’t published under an open source license.
1. Go Bootcamp by Matt Aimonetti
Go Bootcamp – Everything you need to know to get started with Go teachers the reader, among other things, the pros and cons of static typing, what makes the language unique, what Go is good at, and what are the challenging aspects of the language.
The book offers exercises to help cement the knowledge learned.
This companion book contains material initially written specifically for this event as well as content from Google & the Go team under Creative Commons Attribution 3.0 License and code licensed under a BSD license. The rest of the content is also provided under Creative Commons Attribution 3.0 License.
- The Basics – looks at variables and inferred typing, constants, printing constants and variables, packages and imports, code location, exported names, and more.
- Types – includes structs, initializing, composition vs inheritance and more.
- Collection Types – arrays including multi-dimensional arrays, slices, range, and maps are explored.
- Control flow – if statement, for loop, and switch case statement are covered.
- Methods – types and methods allow for an object-oriented style of programming.
- Interfaces – an interface type is defined by a set of methods. A value of interface type can hold any value that implements those methods.
- Concurrency – explores one of the most interesting aspects of the Go language.
- Get Setup – focuses on OS X.
- Get Your Feet Wet.
- Tips and Tricks – shares some tricks experienced developers discovered over time.
2. An Introduction to Programming in Go by Caleb Doxsey
As the title suggests, this is a short, concise introduction to computer programming using the language Go.
- Getting Started – covers files and folders, the terminal, text editors, and Go tools.
- Your First Program – the obligatory “Hello World”.
- Types – built-in data types: Numbers, Strings, and Booleans.
- Variables – covers how to name a variable, scope, constants, defining multiple variables, and closing with an example program.
- Control Structures – start to write useful programs by learning about control structures: for, if, and switch.
- Arrays, Slices and Maps – looks at three more built-in types: arrays, slices and maps.
- Functions – an independent section of code that maps zero or more input parameters to zero or more output parameters.
- Pointers – examines the * and & operators, and new.
- Structs and Interfaces – a struct is a type which contains named fields. For interfaces, the chapter explains the “method set”.
- Concurrency – Go has rich support for concurrency using goroutines and channels.
- Packages – another mechanism for code reuse.
- Testing – Go includes a special program that makes writing tests easier.
- The Core Packages – takes a look at some of the most commonly used packages included with Go.
The online version of the book is available under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License. There is an updated version of the book available to purchase.
3. Building Web Apps with Go by Jeremy Saenz
Building Web Apps with Go is a succinct 39 page book.
The book covers a wide array of web topics.
Most of the material uses the built in packages from the standard library.
Some lessons need a third party package.
This book is licensed under the CC BY-SA 3.0 License, the code is licensed under a BSD 3-Clause License, unless otherwise specified. There are portions of this book that are incomplete.
- Go Makes Things Simple.
- The net/http package – starts with a brief overview of HTTP before moving on to explore an important package, net/http.
- Creating a Basic Web App – in Go.
- Deployment – deploy a web application to Heroku.
- URL Routing – creates some routing for a RESTful resource called “posts”.
- Middleware – shows how to use a Negroni stack with the built in middleware and how to create your own custom middleware.
- Rendering – learn how render HTML and JSON using the methods offered in Go’s standard library.
- Testing – covers the unit-test style approach and an end-to-end approach.
- Controllers – illustrates the benefits in using a controller model.
- Databases – connect to a SQLite database.
- Tips and Tricks.
4. Build Web Application with Golang by Astaxie
This book describes how to develop web application in Go, introducing a lot of basic knowledge, development tools and techniques. The book uses this knowledge to implement a simple web framework.
- Go basic knowledge.
- Web foundation – talks about some concepts of the web and how to run web applications in Go.
- HTTP Form – how to handle form data in Go, and how to validate form data.
- Database – examines the database driver interface design in Go, before moving on to introducing SQM database drivers Go, and then presenting the ORM.
- Data Storage and session – highlights the differences between cookies and sessions, session hijacking, and how to prevent it.
- Text files – XML, JSON, regular expressions, the MVC pattern to develop applications in Go, ending with an introduction to file and folder operations.
- Web services – Sockets, WebSocket, REST, and RPC are covered.
- Security and encryption – CSRF attacks, filter inputs, XSS attacks, SQL injection, password storage, and encrypting and decrypting data.
- Internationalization and localization – time zone, localized resources, and international sites.
- Error handling, debugging and testing – describes how to handle errors in the Go language and how to design your own handling package and functions, how to use GDB to debug programs under dynamic operating conditions. The chapter moves on to explaining unit testing and in-depth discussions and examples on how to write unit tests.
- Deployment and maintenance – logs, errors and crashes, deployment, and backup and recovery.
- Build a web framework – introduces the MVC architecture, a routing and logging system and simple server configuration.
- Develop web framework.
This book is licensed under the CC BY-SA 3.0 License, the code is licensed under a BSD 3-Clause License, unless otherwise specified.
All books in this series:
|Free Programming Books|
|Java||General-purpose, concurrent, class-based, object-oriented, high-level language|
|C||General-purpose, procedural, portable, high-level language|
|Python||General-purpose, structured, powerful language|
|C++||General-purpose, portable, free-form, multi-paradigm language|
|C#||Combines the power and flexibility of C++ with the simplicity of Visual Basic|
|PHP||PHP has been at the helm of the web for many years|
|HTML||HyperText Markup Language|
|SQL||Access and manipulate data held in a relational database management system|
|Ruby||General purpose, scripting, structured, flexible, fully object-oriented language|
|Assembly||As close to writing machine code without writing in pure hexadecimal|
|Swift||Powerful and intuitive general-purpose programming language|
|Groovy||Powerful, optionally typed and dynamic language|
|Go||Compiled, statically typed programming language|
|Pascal||Imperative and procedural language designed in the late 1960s|
|Perl||High-level, general-purpose, interpreted, scripting, dynamic language|
|R||De facto standard among statisticians and data analysts|
|COBOL||Common Business-Oriented Language|
|Scala||Modern, object-functional, multi-paradigm, Java-based language|
|Fortran||The first high-level language, using the first compiler|
|Scratch||Visual programming language designed for 8-16 year-old children|
|Lua||Designed as an embeddable scripting language|
|Logo||Dialect of Lisp that features interactivity, modularity, extensibility|
|Rust||Ideal for systems, embedded, and other performance critical code|
|Lisp||Unique features - excellent to study programming constructs|
|Ada||ALGOL-like programming language, extended from Pascal and other languages|
|Haskell||Standardized, general-purpose, polymorphically, statically typed language|
|Scheme||A general-purpose, functional language descended from Lisp and Algol|
|Prolog||A general purpose, declarative, logic programming language|
|Forth||Imperative stack-based programming language|
|Clojure||Dialect of the Lisp programming language|
|Julia||High-level, high-performance language for technical computing|
|Awk||Versatile language designed for pattern scanning and processing language|
|BASIC||Beginner’s All-purpose Symbolic Instruction Code|
|Erlang||General-purpose, concurrent, declarative, functional language|
|VimL||Powerful scripting language of the Vim editor|
|OCaml||The main implementation of the Caml language|
|ECMAScript||Best known as the language embedded in web browsers|
|Bash||Shell and command language; popular both as a shell and a scripting language|
|LaTeX||Professional document preparation system and document markup language|
|TeX||Markup and programming language - create professional quality typeset text|
|Arduino||Inexpensive, flexible, open source microcontroller platform|
|Elixir||Relatively new functional language running on the Erlang virtual machine|
|F#||Uses functional, imperative, and object-oriented programming methods|
|Tcl||Dynamic language based on concepts of Lisp, C, and Unix shells|
|Factor||Dynamic stack-based programming language|
|Eiffel||Object-oriented language designed by Bertrand Meyer|
|Agda||Dependently typed functional language based on intuitionistic Type Theory|
|Icon||Wide variety of features for processing and presenting symbolic data|
|XML||Rules for defining semantic tags describing structure ad meaning|
|Vala||Object-oriented language, syntactically similar to C#|
|Standard ML||General-purpose functional language characterized as "Lisp with types"|
|D||General-purpose systems programming language with a C-like syntax|
|Dart||Client-optimized language for fast apps on multiple platforms|
|Markdown||Plain text formatting syntax designed to be easy-to-read and easy-to-write|
|Kotlin||More modern version of Java|
|Objective-C||Object-oriented language that adds Smalltalk-style messaging to C|