Code Room
Code reviewMedium
Question
Review this Go fan-out worker that queries replicas and returns the first response.
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 firstReply(ctx context.Context, replicas []string) (string, error) { results := make(chan string) for _, addr := range replicas { go func(a string) { resp, err := query(ctx, a) if err == nil { results <- resp } }(addr) } select { case r := <-results: return r, nil case <-ctx.Done(): return "", ctx.Err() }}Run or narrate your approach, then ask the coach.