AI Copilot for Go Interviews

Prepare for Go interview questions on slices, interfaces and concurrency. In a live round, Hiintly uses the spoken question, code screenshots and the constraints you provide to suggest a Go answer and help you explain how it works.

What are you preparing for?

A Go interview can include a language screen, live coding or a discussion about a service you built. Start with the round you have next.

Go interview questions and answers

In a technical screen, you may be asked to predict what a few lines of code do and explain what changes with a different input. Use the examples in Effective Go to practice reasoning about ownership, zero values and error handling.

Does copying a slice copy its elements?

Assigning one slice to another gives you two slice values that refer to the same underlying array. Writing through one slice can change what the other sees. Appending can reuse the array while there is capacity, or allocate a new one if more space is needed. Use copy into a separate slice when you need independent element storage.

How do you tell if a map key is missing?

Use value, ok := counts[key]. A missing key in a map of integers gives you zero, which is also a value you can store. The boolean tells you which happened. A nil map also allows a lookup, while writing an entry to a nil map panics.

Why can a nil pointer produce a non-nil error?

An interface carries a dynamic type and a value. Assigning a nil *LookupError to an error interface leaves the type set, so comparing the interface with nil returns false. Return an explicit nil on success.

Who should close a channel?

The goroutine that knows all sends are finished should close it if receivers need that signal. With multiple producers, a coordinator can wait for them to finish and then close the channel. A receive can still drain buffered values after closure. Once those are gone, the two-value receive returns the zero value and ok == false.

If the interviewer says “What changes if it has spare capacity?”, submit the transcript together with the slice declaration or a screenshot. Ask Hiintly to trace that exact example so the suggestion accounts for both length and capacity.

Deduplicate IDs in a Go coding exercise

Given a slice of IDs, return each distinct ID once, in the order it first appeared. For example, ["b", "a", "b", "c", "a"] should return ["b", "a", "c"]. The interviewer can use this exercise to check whether your data structure fits both uniqueness and ordering.

func uniqueIDs(ids []string) []string {
    seen := make(map[string]struct{})
    var unique []string

    for _, id := range ids {
        if _, exists := seen[id]; exists {
            continue
        }
        seen[id] = struct{}{}
        unique = append(unique, id)
    }
    return unique
}

Make the output order explicit

Walk the original slice and use a map as a set. Append when you first see an ID. This preserves input order without depending on map iteration order. The loop takes expected O(n) time and uses O(k) extra space for k distinct IDs, plus the output.

Check the contract at the edges

Test empty input, a repeated ID and duplicates separated by other values. Ask what empty output should look like. This version returns a nil slice for empty input. If an API expects an empty JSON array, initialize unique with make([]string, 0) so it encodes as [].

Send the changed requirement

If the interviewer asks you to keep the last occurrence, capture the prompt, then type whether the result should follow the order of those last positions. Hiintly can suggest a right-to-left scan followed by reversing the result. Check the change with ["b", "a", "b"], which now becomes ["a", "b"].

For an algorithm round with a different prompt, see how the coding interview copilot handles constraints, edge cases and complexity.

Why can a goroutine outlive a canceled request?

In a Go concurrency interview, the interviewer shows a caller waiting for a profile lookup on an unbuffered results channel. The caller can return as soon as the request is canceled. The question is what happens if the worker reaches its send after that return.

Find the send that can block

results := make(chan profileResult)
go func() {
    profile, err := fetchProfile(ctx, id)
    results <- profileResult{profile, err}
}()

select {
case result := <-results:
    return result.profile, result.err
case <-ctx.Done():
    return Profile{}, ctx.Err()
}

When the caller takes the cancellation branch, it stops receiving. Even if fetchProfile returns promptly with a cancellation error, the goroutine can stay blocked sending that result.

Give the worker a path to exit

go func() {
    profile, err := fetchProfile(ctx, id)
    select {
    case results <- profileResult{profile, err}:
    case <-ctx.Done():
    }
}()

Select between sending and observing cancellation. Keep passing the request context into the lookup, and make sure it reaches the HTTP or database call. When the context is canceled, its Done channel closes. The work can stop when the operations involved observe that signal.

Explain which timeout the code uses

If the lookup needs a shorter budget than the request, derive a context with context.WithTimeout, pass it downstream and defer the returned cancel function. The parent can still cancel it earlier. The Go context package documentation explains deadline propagation and why calling the cancel function releases resources.

Send Hiintly the screenshot and the condition that the channel is unbuffered. Ask it to trace cancellation during the lookup, after the lookup and while the sender is waiting. If the prompt requires a particular outcome when the result and cancellation are both ready, say so. A Go select can choose either ready branch.

How would your Go service handle 200 lookups?

An experienced-level follow-up changes the problem from stopping one goroutine to controlling the load on a dependency and deciding what to return when part of the work fails.

Limit the work in flight

If the upstream service allows eight concurrent calls, use at most eight workers or acquire a semaphore slot before starting work. Say what happens to queued IDs on cancellation. If the limit is shared by the whole service, enforce it across requests as well.

Define what counts as a result

Ask whether one failed lookup should cancel the batch or produce a partial response. If results must follow input order, carry each ID’s input index with its result. Let one collector write into the indexed result slice so the order follows input even when workers finish at different times.

Show how you would verify shutdown

In a test, use a fake dependency that signals when a lookup starts and waits for cancellation. Cancel the request and check that all workers exit within the test deadline. Track the peak number of simultaneous calls separately to verify the concurrency limit. Go’s race detector can flag data races along the code paths your tests exercise.

In a project discussion, give Hiintly the actual dependency limit, the failure policy and the part you implemented. Ask for a concise explanation of your decision and the evidence you gathered. For a round that covers the whole API, practice the backend interview example on request boundaries and API behavior.

Set up Hiintly for your Go round

Choose Coding Interview for a session centered on code, or Software Engineer for a mix of coding and project questions. Add the job description and your resume so Hiintly can use the responsibilities and experience you provide.

During the call, use the transcript for spoken questions and the screenshot action for code in your selected screen source. Add any constraint the screenshot leaves out, then press Send for a suggested answer.

Example Extra Instructions

“Use Go 1.22 and the standard library. Give me the short spoken answer first. For concurrency questions, explain who owns the channel, where a goroutine might block and what happens when the request is canceled.”

Go interview FAQ

What should I practice first for a Golang interview?

Trace a short program with a slice and a map, then implement a small function with a clear input and output contract. For a backend role, add one concurrency problem and prepare to explain how cancellation reaches each dependency.

Can I use the standard library in a Go coding interview?

Check the prompt and editor rules for the Go version, permitted imports and expected function signature. If the environment is restricted, give Hiintly those limits in Extra Instructions so the suggested code fits what you can run.

When would I use a mutex instead of a channel in Go?

A mutex is a straightforward fit when several goroutines update shared state, such as a map whose lookup and update must happen together. A channel fits a job queue or a handoff between stages. Explain which goroutine owns the data and how callers wait, finish or cancel.

What Go interview questions come up for experienced developers?

Prepare to discuss bounding work under load, diagnosing a goroutine that never exits and setting deadlines for downstream calls. Bring an example from your own work and explain the constraint, your decision and how you checked whether it worked.

Can I try Hiintly on Go interview questions for free?

Yes. Start a free 10-minute session without a credit card. Try a spoken question or a code screenshot and send a follow-up that changes one constraint. You can start another free session after the five-minute cooldown.

Try Hiintly with a Go interview question

Start with a snippet from this guide. Ask where the code can block, then change the requirement and see how the suggested answer changes.