Last Updated on April 18, 2024
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.
Chapters include:
- 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.
Chapters cover:
- 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.
Chapters include:
- 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.
Chapters include:
- 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.
Next page: Page 2 – Learning Go and more books
Pages in this article:
Page 1 – Go Bootcamp and more books
Page 2 – Learning Go and more books
Page 3 – Go 101 and more books
All books in this series:
Free Programming Books | |
---|---|
Ada | ALGOL-like programming language, extended from Pascal and other languages |
Agda | Dependently typed functional language based on intuitionistic Type Theory |
Arduino | Inexpensive, flexible, open source microcontroller platform |
Assembly | As close to writing machine code without writing in pure hexadecimal |
Awk | Versatile language designed for pattern scanning and processing language |
Bash | Shell and command language; popular both as a shell and a scripting language |
BASIC | Beginner’s All-purpose Symbolic Instruction Code |
C | General-purpose, procedural, portable, high-level language |
C++ | General-purpose, portable, free-form, multi-paradigm language |
C# | Combines the power and flexibility of C++ with the simplicity of Visual Basic |
Clojure | Dialect of the Lisp programming language |
ClojureScript | Compiler for Clojure that targets JavaScript |
COBOL | Common Business-Oriented Language |
CoffeeScript | Transcompiles into JavaScript inspired by Ruby, Python and Haskell |
Coq | Dependently typed language similar to Agda, Idris, F* and others |
Crystal | General-purpose, concurrent, multi-paradigm, object-oriented language |
CSS | CSS (Cascading Style Sheets) specifies a web page’s appearance |
D | General-purpose systems programming language with a C-like syntax |
Dart | Client-optimized language for fast apps on multiple platforms |
Dylan | Multi-paradigm language supporting functional and object-oriented coding |
ECMAScript | Best known as the language embedded in web browsers |
Eiffel | Object-oriented language designed by Bertrand Meyer |
Elixir | Relatively new functional language running on the Erlang virtual machine |
Erlang | General-purpose, concurrent, declarative, functional language |
F# | Uses functional, imperative, and object-oriented programming methods |
Factor | Dynamic stack-based programming language |
Forth | Imperative stack-based programming language |
Fortran | The first high-level language, using the first compiler |
Go | Compiled, statically typed programming language |
Groovy | Powerful, optionally typed and dynamic language |
Haskell | Standardized, general-purpose, polymorphically, statically typed language |
HTML | HyperText Markup Language |
Icon | Wide variety of features for processing and presenting symbolic data |
J | Array programming language based primarily on APL |
Java | General-purpose, concurrent, class-based, object-oriented, high-level language |
JavaScript | Interpreted, prototype-based, scripting language |
Julia | High-level, high-performance language for technical computing |
Kotlin | More modern version of Java |
LabVIEW | Designed to enable domain experts to build power systems quickly |
LaTeX | Professional document preparation system and document markup language |
Lisp | Unique features - excellent to study programming constructs |
Logo | Dialect of Lisp that features interactivity, modularity, extensibility |
Lua | Designed as an embeddable scripting language |
Markdown | Plain text formatting syntax designed to be easy-to-read and easy-to-write |
Objective-C | Object-oriented language that adds Smalltalk-style messaging to C |
OCaml | The main implementation of the Caml language |
Pascal | Imperative and procedural language designed in the late 1960s |
Perl | High-level, general-purpose, interpreted, scripting, dynamic language |
PHP | PHP has been at the helm of the web for many years |
PostScript | Interpreted, stack-based and Turing complete language |
Prolog | A general purpose, declarative, logic programming language |
PureScript | Small strongly, statically typed language compiling to JavaScript |
Python | General-purpose, structured, powerful language |
QML | Hierarchical declarative language for user interface layout - JSON-like syntax |
R | De facto standard among statisticians and data analysts |
Racket | General-purpose, object-oriented, multi-paradigm, functional language |
Raku | Member of the Perl family of programming languages |
Ruby | General purpose, scripting, structured, flexible, fully object-oriented language |
Rust | Ideal for systems, embedded, and other performance critical code |
Scala | Modern, object-functional, multi-paradigm, Java-based language |
Scheme | A general-purpose, functional language descended from Lisp and Algol |
Scratch | Visual programming language designed for 8-16 year-old children |
SQL | Access and manipulate data held in a relational database management system |
Standard ML | General-purpose functional language characterized as "Lisp with types" |
Swift | Powerful and intuitive general-purpose programming language |
Tcl | Dynamic language based on concepts of Lisp, C, and Unix shells |
TeX | Markup and programming language - create professional quality typeset text |
TypeScript | Strict syntactical superset of JavaScript adding optional static typing |
Vala | Object-oriented language, syntactically similar to C# |
VHDL | Hardware description language used in electronic design automation |
VimL | Powerful scripting language of the Vim editor |
XML | Rules for defining semantic tags describing structure ad meaning |