Code Room
Vibe codingHardvc-g032
Subject Ai code reviewLevel Senior–Staff~20 minCommon in Concurrency interviewsIndustries Software development, Technology

Question

You asked an AI assistant for a Go function that fans out HTTP health checks concurrently and returns the first success, cancelling the rest. It produced:

go
func firstHealthy(ctx context.Context, urls []string) (string, error) {    results := make(chan string)    for _, u := range urls {        go func(u string) {            resp, err := http.Get(u)            if err == nil && resp.StatusCode == 200 {                results <- u            }        }(u)    }    select {    case u := <-results:        return u, nil    case <-ctx.Done():        return "", ctx.Err()    }}

It returns a healthy URL in your test. What goes wrong at scale?

What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.