Go
Goroutines, channels, interfaces, the scheduler, and the Go internals asked in backend interviews.
Fundamentals
What is Go & Why use it
Go in plain English — a compiled, statically typed, garbage-collected language built for concurrency and simplicity.
Variables, Constants & iota
How to declare variables and constants in Go, typed vs untyped constants, and the iota enum trick.
Data Types & Zero Values
Go's basic types and the zero-value concept — why every variable has a sane default and there are no nil surprises.
Functions
Go functions — multiple return values, named returns, variadic params, first-class functions, and closures.
Packages & Go Modules
How Go code is organized into packages and modules — exported vs unexported, go mod, go.mod/go.sum, and the everyday commands.
Types & Data Structures
Arrays vs Slices
Arrays are fixed-size value types; slices are flexible views over a backing array.
Maps
Go's built-in key-value store: comma-ok, random iteration, and the concurrency gotcha.
Structs & Embedding
Grouping fields into types, struct tags, and Go's composition-over-inheritance via embedding.
Methods & Receivers
Value vs pointer receivers — what gets copied, what gets mutated, and which to pick.
Interfaces
Implicit satisfaction, the empty interface, the (type, value) pair, and the nil-interface trap.
Pointers
& and *, why no pointer arithmetic, when to pass pointers, and new vs &T{}.
Type Assertions & Type Switches
Pulling the concrete type back out of an interface — safely, and with a type switch.
Error Handling
The error Interface
Go treats errors as plain values you return and check — no exceptions for normal control flow.
defer, panic & recover
Go's cleanup and crash-control trio — defer schedules cleanup, panic blows up, recover catches it.
Error Wrapping (Is / As)
Wrap errors with %w to keep context and the original error, then inspect the chain with errors.Is and errors.As.
Concurrency
Goroutines
Goroutines in plain English — ultra-cheap, lightweight threads managed by the Go runtime, started with one keyword.
Channels
Channels in plain English — typed pipes goroutines use to talk to each other safely, without locks.
The select Statement
select in plain English — a switch for channels that waits on multiple operations at once.
The sync Package
sync in plain English — Mutex, WaitGroup, Once, and friends for when channels aren't the right tool.
The context Package
context in plain English — the standard way to carry cancellation, deadlines, and request-scoped values across API boundaries.
Concurrency Patterns
The Go concurrency patterns that matter in interviews — worker pools, fan-out/fan-in, pipelines, rate limiting, and cancellation.
Data Races & the Race Detector
Data races in plain English — what they are, why they're nasty, and how Go's race detector catches them.
Runtime & Memory
Garbage Collection
Go's concurrent, low-latency tri-color mark-and-sweep collector, plus GOGC and GOMEMLIMIT tuning.
Stack vs Heap & Escape Analysis
How the Go compiler decides whether a value lives on the fast stack or escapes to the GC-managed heap.
The Scheduler (GMP Model)
How Go's runtime maps millions of goroutines onto a handful of OS threads using the G-M-P model.
Standard Library & Web
net/http
Building HTTP servers and clients with Go's batteries-included net/http package — handlers, ServeMux, middleware, and the 1.22 routing upgrade.
JSON Encoding/Decoding
Turning Go structs into JSON and back with encoding/json — struct tags, the exported-fields rule, structs vs maps, and streaming with Encoder/Decoder.
Generics
Type parameters in Go 1.18+ — writing one function that works for many types, constraints, generic types, and when NOT to reach for them.
Standard Library Essentials
A practical tour of Go's most-used standard library packages — fmt, strings, strconv, time, os/io/bufio, sort, and the newer slices/maps.
Testing & Production
Testing (Table-Driven)
Go's built-in testing package and the idiomatic table-driven test pattern — the #1 Go testing interview answer.
Benchmarks & Profiling
Measuring Go performance with benchmarks, reading ns/op and allocs/op, and finding hotspots with pprof and the race detector.
Go Tooling
A tour of Go's built-in toolchain — build, run, test, fmt, vet, mod tidy, doc — plus the popular linters.
Project Structure & Dependencies
Go modules, the common cmd/internal/pkg layout, the special internal visibility rule, and avoiding circular imports.
Idioms & Best Practices
The grab-bag of idiomatic Go that interviewers love — accept interfaces, return structs, useful zero values, small interfaces, and handling errors over panicking.