Utilities for Gos
Go utilities are the standard library tools for everyday tasks. The os, io and bufio packages handle files and streams, encoding/json and similar packages serialise data, and the testing package supports unit tests, table-driven tests, benchmarks and examples through the go test command.
Stage: Standard Library · Part of the Go roadmap · Last reviewed 19 November 2026
What to learn in Utilities
- Read and write files with os and bufio
- Marshal and unmarshal structs using JSON tags
- Write a table-driven test with subtests
- Run benchmarks and read the ns/op output
- Use io.Reader and io.Writer to compose streaming code
Utilities interview questions
What is a table-driven test in Go?
It defines a slice of test cases, each with inputs and expected outputs, then loops over them calling t.Run for each. This keeps tests compact, makes adding cases easy, and gives clear subtest names when one fails.
Why are io.Reader and io.Writer so important?
They are tiny interfaces that let files, network connections, buffers and compressors be used interchangeably. Functions that accept them, like io.Copy, work with any source or destination and process data as a stream without loading it into memory.
Where Utilities fits in the Go roadmap
Utilities belongs to the Standard Library stage (intermediate level), which takes about 20 hours. Batteries included.