Section 1: Go services from the ground up
Why Go for web services
Go was designed for building networked services at scale, and that history shows in the language. A few properties make it a comfortable choice for APIs.
A single static binary
go build produces one executable with no runtime to install. Deployment is copying a file, or putting it in a very small container image. Startup takes milliseconds, which helps with autoscaling and fast restarts.
Concurrency without callbacks
Every incoming HTTP request in Go's standard server runs in its own goroutine, a lightweight thread managed by the Go runtime. You write ordinary blocking code, such as a database query, and the runtime handles thousands of concurrent requests efficiently. There is no async keyword and no callback chains.
A strong standard library
The net/http package includes a production grade HTTP server and client. encoding/json, database/sql, log/slog, context, testing and net/http/httptest cover most of the rest. Since Go 1.22, http.ServeMux supports method matching and path wildcards, which used to be the main reason to reach for a third party router.
Simplicity by design
Go has a small feature set on purpose. There are no exceptions; errors are values you return and check. There is no inheritance; you compose types and use small interfaces. Formatting is standardised with gofmt. This makes Go code across different teams look remarkably similar, which helps when you join a new project.
Trade offs
Go is more verbose than Python or TypeScript for some tasks, especially error handling. Its type system, while it gained generics in Go 1.18, is simpler than those of languages like Rust or TypeScript. For data science or rich UI work, other ecosystems are stronger. For network services, CLIs and infrastructure tools, Go is often an excellent fit.
Our service: Lendr
Lendr tracks things you lend to friends. Users create items, record loans with a due date and mark them as returned. The API also lists overdue loans and sends reminders in the background. It is small enough to finish, but it touches routing, validation, a relational database, authentication, background work and tests.
In the next lesson, a quick Go refresher focused on what we need for services.