Skip to content
CalliCoder

20 tutorials

Golang tutorials

Every Golang guide on the site, newest first. Each one is built around code you can run.

Go is a small language, and most of the difficulty in learning it comes from unlearning habits carried in from elsewhere. There are no classes, inheritance is composition, errors are values you check rather than exceptions you catch, and the concurrency model is built on communication instead of shared state. These guides work through that adjustment rather than pretending it does not exist.

The fundamentals cover packages and modules, the type system, structs and methods, interfaces and how implicit satisfaction changes the way you design them, slices and maps and the aliasing behaviour that surprises people, and pointers. The concurrency material covers goroutines, channels, select, the sync package and the context package that ties cancellation together.

Everything assumes module mode. GOPATH layout has not been necessary since Go 1.11, and guides that still assume it will send you down a path the toolchain no longer expects.

Error handling gets sustained attention because it is where Go feels most alien and where the conventions matter most. Errors are values, wrapping with %w preserves the chain, and errors.Is and errors.As are how you inspect it. Code that discards errors compiles perfectly and fails silently later, which is precisely why the language makes the check explicit.

The tooling is treated as part of the language rather than an afterthought. go mod tidy, go vet, go test with coverage, table-driven tests and the race detector are standard equipment, and the guides use them rather than describing them.

If you are coming from Java or Python, expect the first week to feel like a downgrade and the second to feel like a relief. The language deliberately omits features you are used to reaching for, and most of the guides here spend a paragraph on what to do instead rather than pretending the omission is not noticeable.

Concurrency deserves its own warning. Goroutines are cheap enough that starting thousands is reasonable, which makes it equally easy to leak them: a goroutine blocked forever on a channel nobody will ever send to is invisible until the process runs out of memory. The guides treat cancellation and shutdown as part of writing concurrent code rather than as an advanced topic bolted on afterwards, because a goroutine with no exit path is a bug from the moment it is written.

All Golang tutorials

Frequently asked questions

Do I need to understand GOPATH?

No. With a `go.mod` at the project root, the module path determines imports and the project can live anywhere on disk.

What is the difference between a package and a module?

A package is one directory of `.go` files. A module is a tree of packages with a `go.mod` at its root that names the module path and its dependencies.

Should I learn goroutines before interfaces?

Interfaces first. Concurrent code leans heavily on them, and the patterns are much easier to read once implicit satisfaction makes sense.

Is Go a good first language?

It is a good second one. The syntax is small, but the design assumes you already have opinions about the things it deliberately leaves out.

How should errors be handled in Go?

As values. Wrap with %w to preserve the chain, inspect with errors.Is and errors.As, and never discard one silently — the compiler will not stop you.

Are table-driven tests covered?

Yes. They are the idiomatic Go test shape and the guides use them throughout rather than treating testing as a separate subject.