Free AI interview assistant

Undetectable AI Interview Assistant

Invisible During Screen Sharing for Live Calls

Cluegent gives real-time interview answers, coding help, screenshot-aware context, and meeting support from a private Windows and macOS desktop overlay for Zoom, Meet, Teams, and technical calls.

Try for free
Get for Windows

Used by 4,000+ people

Live desktop AI copilot
Resume-aware answers Screenshot coding help Zoom · Meet · Teams

Interview questions and worked examples

Golang Interview Questions: Goroutines, Channels and Cancellation

Practice Go interview questions on slices, goroutines, channels, errors and cancellation, with an original bounded-worker scenario.

Practice Go interview questions on slices, goroutines, channels, errors and cancellation, with an original bounded-worker scenario. These original practice questions connect a concept to a decision and a failure case. They are preparation exercises, not leaked employer questions. State your assumptions before proposing an implementation.

How are slices different from arrays?

An array has a fixed length as part of its type. A slice describes a view over an underlying array and has a length and capacity. Two slices can share storage, so changing an element can affect another view. Explain whether your function may retain or modify the input. Appending may reuse storage or allocate new storage; do not promise that every append creates an independent copy.

What does a goroutine give you?

It runs a function concurrently under the Go runtime. Concurrency is a way to organize overlapping work; it is not a promise that every task runs simultaneously on separate hardware. Discuss how work starts, how completion is observed and how the goroutine ends. A service that starts a goroutine for every incoming item without a limit can consume resources faster than its dependencies can process requests.

When would you use a channel rather than a mutex?

A channel can coordinate communication and work transfer; a mutex can protect access to shared state. Choose based on the ownership and coordination requirement rather than treating one as universally preferable. Explain who sends, who receives and who closes a channel. A buffered channel can absorb a limited burst, but it does not create unlimited downstream capacity or remove the need for a backpressure decision.

How should a request propagate cancellation?

Pass the request's context through operations that support cancellation and define when workers stop accepting work. Cancellation is cooperative, and a completed external side effect may still need reconciliation. Ask who owns shutdown and how a blocked sender or receiver can exit. Simply returning from the handler does not establish that all goroutines started by that handler have stopped.

How do you explain useful error handling?

Return an error with enough operation context for the caller to act, preserve relevant error identity when wrapping and decide where the error should be reported. Avoid logging the same failure at every layer. Distinguish a missing record, invalid input and a temporary dependency failure. Your answer should include what the caller does next, not merely how an error message is formatted.

Worked interview scenario

Original case: an endpoint checks availability with three suppliers. A naive design starts unbounded background calls for every incoming request and never cancels them after the client disconnects. Describe a bounded worker or concurrency limit and propagate request cancellation to supplier calls that support it.

Define whether the response needs all three results or can use a partial result. If a supplier is slow, state the timeout and the user-visible outcome. Test cancellation while a worker is sending a result and while it waits for a task. The goal is to account for every worker's exit, not simply make the main handler finish quickly.

Practice exercise

Draw the worker lifecycle: accept a task, start a call, produce a result and exit. Rehearse what happens when the client leaves at each point. Then explain a slice example in which two views share an element and identify where an explicit copy is needed. Finish with one measurement that would reveal a growing backlog.

Review your explanation

Use Cluegent during practice to challenge your own draft. Ask for a follow-up about the scenario's weakest assumption, answer it without suggestions, then check your reasoning against the official reference. Review current plans before subscribing. Follow the employer's tool policy in the actual interview.

Sources checked

These official references support the guide. Product details and technical documentation can change; check the linked source for current information.

Where Cluegent helps

Cluegent supports permitted live workflows with transcript context, typed prompts, screenshot-aware answers, resume context, custom response behavior, quick action buttons, and a private desktop overlay. It is most useful when you already understand the subject and need help staying structured under pressure.

Frequently asked questions

Are goroutines the same as operating-system threads?

They are scheduled by the Go runtime. Explain concurrency and resource use without assuming one dedicated OS thread per goroutine.

Does a buffered channel solve overload?

It provides bounded buffering. You still need limits, cancellation and a policy for demand exceeding processing capacity.