Repolode
quii

quii/learn-go-with-tests

A free, open-source book that teaches Go programming from scratch by writing tests first, using TDD.

Stars
23,921
Forks
2,934
Open issues
6
Last commit
25 days ago

What is it?

Learn Go with Tests is a hands-on tutorial that teaches the Go language through test-driven development. Each chapter introduces a concept, such as structs, interfaces, concurrency, or generics, by writing a failing test first and then the code that makes it pass.

The material is organized in three parts: Go fundamentals covering syntax and standard library basics, a guided build of a small application covering HTTP servers, JSON, file IO, command-line tools and WebSockets, and a section on testing topics such as acceptance tests, fakes versus mocks, and refactoring. A Q&A section covers common testing questions like testing OS commands or custom error types.

The book is available online as a Gitbook, as EPUB or PDF downloads, and in many translations including Chinese, Japanese, Korean, French and Russian.

Key features

  • 01Teaches Go syntax and concepts by writing tests before implementation.
  • 02Covers the standard library, including net/http, encoding/json, and sync.
  • 03Builds a complete small application step by step.
  • 04Includes chapters on generics, concurrency, context, and reflection.
  • 05Offers free online reading, EPUB and PDF downloads, and multiple translations.

Use cases

  • Learning Go as a first language while practicing TDD.
  • Experienced Go developers who want to deepen their testing habits.
  • Teaching a team Go fundamentals through a structured, test-based curriculum.
  • Reviewing testing patterns like table-driven tests, mocks, and acceptance tests.

Quick start

  1. 1

    Open the online book in the Gitbook format

  2. 2

    Install Go, then read the first chapter

Things to know

  • The content is a book, not a software library, so there is nothing to install as a dependency.
  • Some chapters are marked as work in progress by the author.

In collections

Topics

FAQ

What is learn-go-with-tests?
A free, open-source book that teaches Go programming from scratch by writing tests first, using TDD. Learn Go with Tests is a hands-on tutorial that teaches the Go language through test-driven development. Each chapter introduces a concept, such as structs, interfaces, concurrency, or generics, by writing a failing test first and then the code that makes it pass.
Is learn-go-with-tests free to use? What license does it have?
learn-go-with-tests is open source under the MIT license. Check the license terms before using it in commercial products.
Is learn-go-with-tests still maintained?
Actively maintained. The last commit to learn-go-with-tests was on Sep 30, 2026.
What can I use learn-go-with-tests for?
Learning Go as a first language while practicing TDD. Experienced Go developers who want to deepen their testing habits. Teaching a team Go fundamentals through a structured, test-based curriculum. Reviewing testing patterns like table-driven tests, mocks, and acceptance tests.
How do I install learn-go-with-tests?
Open the online book in the Gitbook format Install Go, then read the first chapter
Where can I get learn-go-with-tests?
The source code and installation instructions are on GitHub: https://github.com/quii/learn-go-with-tests

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects