Let's Go

190 ratings
I want this!

Let's Go

Alex Edwards
190 ratings

Let's Go teaches you step-by-step how to create fast, secure and maintainable web applications using the fantastic programming language Go.

The idea behind the book is to help you learn by doing. Together we'll walk through the start-to-finish build of a complete web application — from structuring your workspace, through to session management, authenticating users, securing your server and testing your application.

Building a complete web application has a number of benefits: it helps put the things you're learning into context, demonstrates how different parts of your codebase link together, and forces us to work through the edge-cases and difficulties that come up when writing software in real-life. In essence, you'll learn more that you would by just reading Go's (great) documentation or standalone blog posts.

Although you can read the book cover-to-cover, it's designed specifically for you to follow along and build the application yourself.

Break out your text editor, and happy coding!

— Alex

Fully updated for Go 1.19!

Want to get a feel for the book? Take a look through the free sample.

"The book is brilliant, I’m learning so much from it. It’s definitely the best book I’ve read on developing a non-trivial web app with Go." — John Zanchetta

“I feel like this is the best programming book I've ever read. I came in with a basic understanding of golang relative to web development and this book clearly broke down all the essentials you need to get up to speed with the language in a web dev context.” — Michael Deigl

"If you've completed the Golang intro material but are wondering how to begin writing production apps, I strongly recommend Let's Go. Reading & implementing it took my Go project from spindly spaghetti code to well-structured, testable packages" — Mario Vega

“Thank you for the Golang book you've produced, it was fantastic. Your explanations and walkthrough felt like I was being taught by a veteran over the shoulder. I got exactly what I was expecting and in comparison to other tutorial books this one is leagues ahead.” — Jack Callister


There are two packages to choose from:

  • Let's Go Book - The complete book in HTML, PDF and EPUB format ($34.95).
  • Let's Go Professional Package - The complete book in HTML, PDF and EPUB format, plus the full source code from each chapter in the book, printable cheatsheets for net/http and database/sql, and guided exercises to check your understanding ($59.95).

What you'll learn

  • All the fundamentals — How to start a server, create handlers, send responses, route requests and serve static files.
  • Structure and organization — How to create an idiomatic and scalable structure for your web application.
  • Using Modules — How to use Go's Module functionality to manage and version control your dependencies.
  • Managing configuration — How to use command-line flags and dependency injection to manage your application settings.
  • Logging and Error Handling — How to implement leveled logging and centralized error handling.
  • SQL databases — How to design a database model, set up a connection pool, and execute statements and queries.
  • HTML templating — How to cache your templates, display dynamic data, create custom functions and handle runtime errors.
  • Middleware — How to create your own middleware to perform common actions (like logging requests and recovering panics).
  • RESTful routing — How to create a modern request routing structure that follows the principles of REST.
  • Form validation — How to implement reusable and user-friendly pattern for validating forms and displaying errors.
  • Session management — How to use and configure sessions to persist data between requests.
  • Using HTTPS — How to correctly setup a HTTPS server and configure it for improved performance and security.
  • Prevent common vulnerabilities — How to prevent SQL injection, CSRF, XSS, clickjacking and slow-client attacks.
  • Authentication and authorization — How to safely encrypt user passwords and add signup, login and logout functionality.
  • Request context — How to use Go's context.Context to pass data between your middleware and handlers.
  • Testing — How to create unit tests, integration tests and end-to-end tests, mock dependencies and measure test coverage.
  • And most importantly… How to put it together in a fully-functioning application!


1. Introduction

— 1.1. Prerequisites

2. Foundations

— 2.1. Project setup and creating a module

— 2.2. Web application basics

— 2.3. Routing requests

— 2.4. Customizing HTTP headers

— 2.5. URL query strings

— 2.6. Project structure and organization

— 2.7. HTML templating and inheritance

— 2.8. Serving static files

— 2.9. The http.Handler interface

3. Configuration and error handling

— 3.1. Managing configuration settings

— 3.2. Leveled logging

— 3.3. Dependency injection

— 3.4. Centralized error handling

— 3.5. Isolating the application routes

4. Database-driven responses

— 4.1. Setting up MySQL

— 4.2. Installing a database driver

— 4.3. Modules and reproducible builds

— 4.4. Creating a database connection pool

— 4.5. Designing a database model

— 4.6. Executing SQL statements

— 4.7. Single-record SQL queries

— 4.8. Multiple-record SQL queries

— 4.9. Transactions and other details

5. Dynamic HTML templates

— 5.1. Displaying dynamic data

— 5.2. Template actions and functions

— 5.3. Caching templates

— 5.4. Catching runtime errors

— 5.5. Common dynamic data

— 5.6. Custom template functions

6. Middleware

— 6.1. How middleware works

— 6.2. Setting security headers

— 6.3. Request logging

— 6.4. Panic recovery

— 6.5. Composable middleware chains

7. Advanced routing

— 7.1. Choosing a router

— 7.2. Clean URLs and method-based routing

8. Processing forms

— 8.1. Setting up a HTML form

— 8.2. Parsing form data

— 8.3. Validating form data

— 8.4. Displaying errors and repopulating fields

— 8.5. Creating validation helpers

— 8.6. Automatic form parsing

9. Stateful HTTP

— 9.1. Choosing a session manager

— 9.2. Setting up the session manager

— 9.3. Working with session data

10. Security improvements

— 10.1. Generating a self-signed TLS certificate

— 10.2. Running a HTTPS server

— 10.3. Configuring HTTPS settings

— 10.4. Connection timeouts

11. User authentication

— 11.1. Routes setup

— 11.2. Creating a users model

— 11.3. User signup and password encryption

— 11.4. User login

— 11.5. User logout

— 11.6. User authorization

— 11.7. CSRF protection

12. Using request context

— 12.1. How request context works

— 12.2. Request context for authentication/authorization

13. Optional Go features

— 13.1. Using embedded files

— 13.2. Using generics

14. Testing

— 14.1. Unit testing and sub-tests

— 14.2. Testing HTTP handlers and middleware

— 14.3. End-to-end testing

— 14.4. Customizing how tests run

— 14.5. Mocking dependencies

— 14.6. Testing HTML forms

— 14.7. Integration testing

— 14.8. Profiling test coverage

15. Conclusion

16. Further reading and useful links

I want this!
Last updated
August 4th, 2022
Written for
Go 1.19
US English
391 pages (in PDF format)


(190 ratings)
5 stars
4 stars
3 stars
2 stars
1 star
Powered by