Skip to main content

Interactive course

Course Go

Learn Go from scratch with guided exercises, static control and links to the official Go Playground: start from types and functions, arrive at interfaces, concurrency, tests and small HTTP handlers.

Static verification via keywords + execution on the official Go Playground (one click for copy code + open).

01 · Basics of language

5 lessons

The foundation: packages, variables, types, constants, operators and input/output with the fmt package.

  1. 1.1Variables and typesvar, short declaration `:=`, basic types (int, float64, string, bool), and the concept of static typing.~10 min
  2. 1.2Zero value and type conversionsEach variable has a default value; the conversions are explicit (`int(x)`, `string(b)`).~10 min
  3. 1.3Constants and iota`const`, untyped constants, and the `iota` pattern to generate readable enums.~10 min
  4. 1.4OperatorsArithmetic, comparison, logical, bitwise; precedence and differences compared to other languages.~8 min
  5. 1.5Input/output with fmt`fmt.Println`, `fmt.Printf`, verb format (`%d`, `%s`, `%v`, `%T`) and when to prefer one or the other.~10 min

02 · Flow Control

5 lessons

Decisions and repetitions: if with init statements, the unique `for`, idiomatic switch and explicit error handling.

  1. 2.1if, else and init statementsThe form `if v := f(); v > 0 { ... }` and why the ternary operator does not exist in Go.~10 min
  2. 2.2for: the only loopThe three forms of `for`: three-clause, one-condition (= while), infinitive; use of `break` and `continue`.~10 min
  3. 2.3for...rangeIterate over slice, map and strings; the returned value is a copy, when ignoring index or value with `_`.~10 min
  4. 2.4idiomatic switchNo implicit fallthrough, complex expressions in cases, unconditional switches as if chains.~10 min
  5. 2.5Errors: the `if err != nil` patternErrors are values; the fundamental pattern `if err != nil { return err }` and why Go has no exceptions.~12 min

03 · Functions

5 lessons

Functions as first class citizens: signature, multiple returns, variadic parameters, closure and `defer`.

  1. 3.1Signature and parametersSyntax `func nome(p tipo) tipo`, pass by default value, parameters of the same type grouped.~10 min
  2. 3.2Multiple returns and named returnsReturning multiple values (`value, err`), the named returns pattern, and when NOT to use it.~12 min
  3. 3.3Variadic functions`func sum(nums ...int) int`, spread of slice with `slice...`, examples from stdlib.~10 min
  4. 3.4Closures and functions as valuesAnonymous functions that capture variables from the external context; adapter and factory patterns.~12 min
  5. 3.5`defer`: guaranteed cleanupPostpone execution until return; pattern `defer f.Close()`, LIFO order, gotcha with loops.~12 min

04 · Collections

5 lessons

Array, slice (the most important structure), map, rune in strings and sorting.

  1. 4.1Fixed length arraySyntax `[N]T`, because real arrays are rarely used in Go, array conversion → slice.~8 min
  2. 4.2Slice: the idiomatic structure`make`, `append`, len/cap, slicing `s[a:b]`, share of the underlying array and when to copy.~15 min
  3. 4.3Map: keys and valuesDeclaration, access with comma-ok (`v, ok := m[k]`), `delete`, non-deterministic iteration.~12 min
  4. 4.4Strings, byte and runeThe strings are byte UTF-8; `range` produces rune; `len()` counts byte not characters.~12 min
  5. 4.5Sorting with the sort package`sort.Ints`, `sort.Strings`, `sort.Slice` with comparison function, stability.~10 min

05 · Structs and methods

5 lessons

Composite data types: struct, methods on receiver value or pointer, composition (no inheritance) and tag.

  1. 5.1Define and use one struct`type Persona struct { Nome string; Eta int }`, positional vs nominal initialization, struct anonymous.~12 min
  2. 5.2Methods: receiver value vs pointer`func (p Persona) Hello()` vs `func (p *Persona) Rename(n string)`; when one, when the other.~14 min
  3. 5.3Composition (embedding)In Go there is no inheritance: it is composed by embedding one type inside another. Promotion of methods.~12 min
  4. 5.4Field tags and JSON`json:"nome,omitempty"`, marshalling/unmarshalling with `encoding/json`, common errors.~12 min
  5. 5.5Constructor Pattern `New...`Go has no constructors: the convention is a `NewT(...) *T` function that does validation and returns errors.~10 min

06 · Interfaces

5 lessons

Structural interfaces (no explicit implementations), assertion, type switches and the standard `Stringer` and `error` interfaces.

  1. 6.1Interfaces: define a behaviorAn interface is a set of methods; whoever implements them satisfies it automatically (static duck typing).~12 min
  2. 6.2Type assertion`v, ok := i.(*MyT)`, the form with comma-ok to avoid panic, when preferring an assertion to the type switch.~10 min
  3. 6.3Type switch`switch v := x.(type) { case int: ... }` for dispatcher on runtime type.~10 min
  4. 6.4The Stringer interfaceImplementing `String() string` changes how `fmt.Println` represents your type.~10 min
  5. 6.5The error interface`error` is just `Error() string`; create custom errors, `errors.Is`, `errors.As`, `fmt.Errorf("%w", err)`.~14 min

07 · Competition

5 lessons

The concurrency model of Go: goroutine read, channel for communication, `select`, sync and context.

  1. 7.1Goroutine: light parallelism`go f()`, cost of a goroutine, why the main ends without waiting and how to synchronize.~12 min
  2. 7.2Channel: typed communication`ch := make(chan int)`, `ch <- v`, `v := <-ch`, channel buffered vs unbuffered, closing.~15 min
  3. 7.3`select`: channel multiplexingWait for the first ready channel, case `default` to not block, pattern timeout with `time.After`.~12 min
  4. 7.4`sync.Mutex` and `sync.WaitGroup`When channels are not enough: protect shared state with Mutex, wait N goroutine with WaitGroup.~14 min
  5. 7.5`context.Context`: cancellation and deadlinePropagate deletion between goroutine, `context.WithTimeout`, `ctx.Done()`, the first parameter pattern.~14 min

08 · Essential standard library

5 lessons

The packages you will use every day: fmt, strings, strconv, io, os, time, encoding/json.

  1. 8.1`fmt` advanced`Sprintf`, `Fprintf`, `%+v` and `%#v` verbs, width and precision formatting, `-` and `0` flags.~10 min
  2. 8.2`strings` and `strconv``strings.Contains/Split/Join/TrimSpace`, `strconv.Itoa/Atoi/ParseInt/FormatFloat`.~12 min
  3. 8.3`io` and `os`: files and streams`os.Open/Create/ReadFile/WriteFile`, the `io.Reader/Writer` interfaces, `defer f.Close()` patterns.~14 min
  4. 8.4The package `time``time.Now()`, durations, parsing with the reference layout `2006-01-02 15:04:05`, timers and tickers.~12 min
  5. 8.5`encoding/json``json.Marshal/Unmarshal`, struct tag, `json.Decoder/Encoder` per stream, parsing errors.~14 min

09 · Testing, modules and tooling

5 lessons

The `go test` tool, table-driven testing, benchmarking, dependency management with `go mod` and build tags.

  1. 9.1The package `testing`Files `*_test.go`, functions `TestXxx(t *testing.T)`, `t.Error` vs `t.Fatal`, `go test ./...`.~12 min
  2. 9.2Table-driven testingThe idiomatic pattern: slice of anonymous struct with expected input and output, `t.Run(name, ...)` per sub-test.~14 min
  3. 9.3Benchmarks and profilesFunctions `BenchmarkXxx(b *testing.B)`, the loop `for i := 0; i < b.N; i++`, `go test -bench=.`.~12 min
  4. 9.4Go modules`go mod init`, `go get`, semantic import versioning, lockfile `go.sum`, `go mod tidy`.~12 min
  5. 9.5Build constraints and tagsThe `//go:build ...` directive for cross-platform, separate test/integration code, real examples.~10 min

10 · Idiomatic practice

5 lessons

Naming, advanced error handling, generics (Go 1.18+) and two mini-projects: CLI and server HTTP.

  1. 10.1Naming convention and stylePascalCase for export, camelCase for local, short names in short scopes, `gofmt` is out of the question.~10 min
  2. 10.2Idiomatic error handlingSentinel errors (`io.EOF`), custom errors with `Unwrap`, wrapping with `%w`, when to use `panic`.~14 min
  3. 10.3Generics (Go 1.18+)Type parameter `func Map[T, U any](s []T, f func(T) U) []U`, constraints (`comparable`, custom), trade-off.~15 min
  4. 10.4Mini-project: a CLI with flag`flag` package, commands and sub-commands, exit code, `log` vs `fmt` for outputs.~18 min
  5. 10.5Mini-project: a server HTTP`net/http`, minimal handler and router, middleware as decorator, graceful shutdown with context.~18 min
Frequently asked questions

Course Go FAQ

How many lessons and hands-on exercises are in Course Go?

Course Go covers 10 modules, 50 interactive lessons, and 250 practical exercises (~10 hours total) with instant automated validation.

Do I need local setup or IDE installation for Course Go?

No installation required: every exercise and the interactive Course Go playground execute right in your browser via WASM and isolated sandboxes, with instant feedback.

Is Module 1 of Course Go free without creating an account?

Yes. Module 1 (“Module 1 — Basics of language”), the live playground, and the printable cheatsheet are permanently free without signup, saving your progress locally in your browser.

Which career learning paths include Course Go?

Course Go is a core building block of Backend, Systems & DevOps, targeting roles such as Backend Engineer · Systems / SRE · Platform Engineer.