Interview preparation guide
Go Interview Questions With Runnable Exercises
Practice Go interview questions by explaining the model, working through a small problem and checking failure cases. These original exercises test reasoning rather than recall of a claimed employer question list.
Scope and assumptions
The runnable example uses only Go’s standard library and can be saved as main.go. It requires a local Go toolchain and makes no network or filesystem requests.
Confirm the version, deployment model and permissions in the interview. The examples use fictional data and are deliberately small. A snippet demonstrates one idea; it is not a complete production system.
How do interfaces support composition?
A type satisfies an interface by implementing its methods. Keep interfaces focused on the behavior the consumer needs rather than creating a broad interface for every concrete type.
How should errors be handled?
Return and check errors with enough context to act on them. Avoid silently discarding a failure or using panic for ordinary expected conditions. Explain who owns recovery at each boundary.
What does a goroutine guarantee?
It starts concurrent execution, not a particular scheduling order or automatic synchronization. Shared mutable state still needs a safe design, and goroutines need a lifecycle and cancellation strategy.
Why use channels or synchronization?
They coordinate work and data access. Choose the mechanism that makes ownership and completion clear. More goroutines do not automatically improve throughput when another resource is the bottleneck.
Worked exercise
Predict the output, then run go run main.go in a practice folder. Explain why the receive waits and why the program does not need a sleep.
package main
import "fmt"
func main() {
result := make(chan int)
go func() { result <- 3 * 7 }()
fmt.Println(<-result)
}Expected result and explanation
The output is 21. The unbuffered channel coordinates the send and receive, so the main goroutine waits for the value rather than relying on a timing delay. In a larger program, consider cancellation and what happens if a receiver stops listening.
Before changing the example, predict the result. Then vary one input or constraint and explain why the behavior should change. Keep the distinction between a measured result and an assumption clear.
Debugging and follow-up
For a race or leaked goroutine, identify who owns the state, who closes the channel and how work terminates. Use appropriate tests and the race detector with a real Go toolchain; a successful single run does not prove race freedom.
- What evidence would distinguish your first explanation from an alternative?
- Which boundary, permission or failure case should be checked?
- How would you reproduce the issue without affecting live users?
Practice checklist
Explain one design decision aloud and support it with the worked example. Use the official documentation below to check version-specific behavior.
- I stated the relevant version and environment.
- I can explain the expected result and an edge case.
- I can separate correctness, performance and security concerns.
- I know which parts require a real runtime or service to verify.
Questions, answered
Are these questions used by a particular employer?
No. They are original practice questions. Employers can assess different tools, versions and levels of depth.
How should I verify the exercise?
Use an isolated local or sandbox environment with the stated prerequisites. Compare the expected result, then test an edge case. Do not run service commands against a shared or production system.
Sources and examples
ResumizeAI team. Examples are fictional teaching material, not customer results. Replace sample details with your own facts.
Your experience. A complete resume.
Build in Resumize with ATS-friendly templates, guided editing and a live preview. Start free, then upgrade when you need more.
Free account required. Free-plan PDF exports include a watermark.