By Caleb Doxsey (166 pages)
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.
By Matt Aimonetti (118 pages)
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.
- 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
The book is released under the Creative Commons Attribution 3.0 License and code licensed under a BSD license.
By Jeremy Saenz (39 pages)
Building Web Apps with Go covers a wide array of web topics.
- 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
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.
By Astaxie (327 pages)
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.
By Mike Gieben (HTML)
This book is aimed at developers with some knowledge of programming languages and how to program.
- Introduction – details the lineage of the language and shows the types, variables and control structures
- Functions – how to make and use functions
- Packages – functions and data are grouped together in packages. Here you’ll see how to make your own package. How to unit test your package is also described
- Beyond the basics – learn how to create your own data types and define functions on them (called methods)
- Interfaces – Go does not support Object Orientation in the traditional sense. In Go the central concept is interfaces
- Concurrency – with the go keyword functions can be started in separate routines (called goroutines). Communication with these goroutines is done via channels
- Communication – how to create/read/write from and to files. And how to do networking
This work is licensed under the Attribution-NonCommercial-ShareAlike 3.0 Unported License.
By Suraj Patil (191 pages)
This book teaches you how to write web applications in Go without using a framework. Each new concept is explained with a valid code example.
- Variables & Data Structures
- Control statements and Functions
- Managing the Workspave
- Web Programming Basics
- Basic web application
- Designing our web app
- Using databases in Go
- Accessing the database
- Retrieving Result Sets
- Modifying Data and Using Transactions
- Using Prepared Statements
- Handling Errors
- Working with NULLs
- Working with Unknown Columns
- The connection pool
- Surprises, Antipatterns and Limitations
- Database Encapsulation
- An Example
- Working with Forms
- Uploading files
- Building an API
- Writing a client
- Unit Testing
- Version Control Basics
The book is released under an open source license.
By Karl Seguin (84 pages)
The Little Go Book is an introduction to Google’s Go programming language. It’s aimed at developers who aren’t that comfortable with the idea of pointers and static typing.
- The Basics
- Maps, Arrays and Slices
- Code Organization and Interfaces
- Tidbits – talks about a miscellany of Go’s features
The Little Go Book is licensed under the Attribution-NonCommercial-ShareAlike 4.0 International license.
By Big Yuuta (HTML)
Let’s learn Go is an online resource which aims to introduce people to Go, and have some fun at the same time.
Learn the very basic things about Go. This includes the basic syntax for programs, how to declare variables, pointers, and how to use basic control structure.
The online book then moves on to teaching the reader how to use primitive data types and basic control structures to build composite types and functions. The book later delves deeper into functions and solving real world problems.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.