Go interviews focus on goroutines, channels, interfaces, and error handling — the language is small, so questions go deep rather than wide. Below are the most common ones with model answers. Senior: architecture, trade-offs, mentoring, and decision-making.
Try it — no account needed
Preparing your question…
Topics to prepare
✓Goroutines and the scheduler
✓Channels and select
✓Interfaces and composition
✓Error handling
✓Slices and maps
✓Context and cancellation
6 Senior-level questions with answers
1
How would you bound concurrency when processing a large queue?
Answer
A worker pool: a fixed number of goroutines reading one channel, so the parallelism is a number you chose rather than a number the input decided. A semaphore channel works too for finer control. The failure to avoid is spawning a goroutine per item — it looks elegant and takes down whatever is downstream, which is usually a database connection pool.
2
What causes a memory leak in a garbage-collected language like Go?
Answer
A reference that stays reachable: a growing map used as a cache with no eviction, a goroutine parked forever holding its stack, a slice of a huge array keeping the whole backing store alive. The last one surprises people — reslicing a large buffer to three bytes retains all of it until you copy.
3
How do you profile a Go service that got slower?
Answer
pprof over the running process rather than guesses: CPU profile for where the time goes, heap profile for allocation, and the goroutine profile if it smells like blocking. Allocation is the frequent culprit in Go — reducing garbage often beats optimising the algorithm, because the collector's work is proportional to what you create.
4
How do you shut a service down without dropping in-flight work?
Answer
Catch SIGTERM, stop accepting new connections, cancel the root context so workers wind down, wait on a WaitGroup with a timeout, then exit. The timeout matters: a shutdown that waits forever on one stuck request is an outage of its own. The readiness probe must fail before any of this starts, so the load balancer stops sending traffic first.
5
When are generics the right tool, and when are they not?
Answer
They earn their place when the same logic is genuinely repeated across types — a container, a map or filter over slices, a constraint on numeric types. They are the wrong tool when an interface already expresses the requirement, because an interface is simpler to read and to change. Go went a decade without them for a reason, and most code still does not need them.
6
How do you structure a Go project as it grows?
Answer
By what the code does rather than what it is: a package per domain concern, not a package called models holding everything. Keep the dependency direction inward, put anything not meant for import under internal/, and resist a utils package, which is where cohesion goes to die. The standard library is the style guide worth copying.
🦎
Reading answers is not enough
In a real interview you speak under pressure. Cam asks these same questions, scores every answer, and shows exactly what to fix.