Code Room
Code reviewHard
Question
Review this Go fan-out helper that returns the first successful result.
What goes wrong here?
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
func fastest(ctx context.Context, urls []string) (string, error) { results := make(chan string) // unbuffered for _, u := range urls { go func(u string) { body, err := fetch(ctx, u) if err == nil { results <- body // (1) } }(u) } select { case r := <-results: return r, nil case <-ctx.Done(): return "", ctx.Err() }}Run or narrate your approach, then ask the coach.