Courses
Go for Beginners: Write Reliable Programs and Small Services
Check Yourself
Five scenario questions on error wrapping, errors.Is, exported identifiers, and table-driven tests.
Course content
Join this Course
Sign in to save your progress.
-
Before You Write Code
-
Why Go Exists and When to Pick It
-
Run Your First Go Program
-
-
-
Values, Control Flow, and Functions
-
Variables, Types, and Zero Values
-
If, For Loops, and Multiple Return Values
-
-
-
Slices, Maps, and Structs
-
Arrays, Slices, and Why append Matters
-
Maps, Structs, and Pointer Receivers
-
-
-
Errors, Packages, and Testing
-
Handle Errors Without Hiding Them
-
Packages, Exports, and go test
-
-
-
Files, JSON, and a Small HTTP Server
-
Read Files and Decode JSON Structs
-
Build and Test a Small net/http Server
-
-
-
Pointers, Modules, and CLIs
-
Pointers and Memory Basics
-
Managing Dependencies and internal/ Packages
-
Building CLIs With flag, os.Getenv, and Exit Codes
-
-
1.
`loadConfig` returns `fmt.Errorf("load config %s: %w", path, err)` when `os.ReadFile` fails. Why does `err == os.ErrNotExist` evaluate to false?
2.
In package `pricing`, you want callers in `main` to use `ApplyPercent` while keeping `roundCents` internal. How do you express that in Go?
3.
You create `pricing/discount_test.go` with unit tests. Will `go build` include those test functions in your production binary?
4.
Inside a table-driven test loop (`t.Run`), when should you prefer `t.Fatalf` over `t.Errorf`?
About
Five scenario questions on error wrapping, errors.Is, exported identifiers, and table-driven tests.
- Duration
- 5 min
- Last update
- 11/27/2026
Was this helpful?
0
0
Comments
Sign in to commentNo comments yet.