Skip to content

Standard Library

Go ships with one of the most capable standard libraries of any language. From HTTP servers to JSON encoding to a full testing framework -- most Go programs need few external dependencies. This section covers the packages you'll use daily.


# Topic What You'll Learn Level
1 Input & Output fmt verbs, os.Stdin/Stdout, bufio.Scanner, format strings Beginner
2 File I/O & OS Operations Read/write files, filepath.WalkDir, temp files, env vars Intermediate
3 JSON & XML Encoding Marshal/unmarshal, struct tags, streaming, json.RawMessage Intermediate
4 HTTP Client & Server net/http, handlers, middleware, Go 1.22 routing, graceful shutdown Intermediate
5 Error Wrapping & Custom Errors %w, errors.Is, errors.As, error chains, custom types Intermediate
6 Defer, Panic & Recover LIFO order, cleanup patterns, recovery middleware Intermediate
7 Closures & Anonymous Functions Variable capture, loop gotcha, middleware pattern Intermediate
8 Go Modules & Dependencies go.mod, versioning, MVS algorithm, vendoring, workspaces Intermediate
9 Unit Testing Table-driven tests, subtests, t.Helper(), coverage Intermediate
10 Advanced Testing Mocks, fuzz testing, integration tests, golden files, benchmarks Advanced

Interview Quick Hits

  • Go's net/http is production-grade -- no framework needed for most services
  • Table-driven tests are THE Go testing pattern -- every interviewer expects them
  • errors.Is walks the error chain; errors.As extracts typed errors -- know both
  • Defer runs in LIFO order; arguments are evaluated at the defer statement, not when executed
  • Go modules use Minimum Version Selection (MVS) -- unique among package managers
  • Go 1.22 added method+pattern routing: mux.HandleFunc("GET /users/{id}", handler)