Code Room
Code reviewHardcr-g419
Subject Goroutine leaksLevel Senior–Staff~30 minCommon in Code quality & review interviewsIndustries Software development, Technology

Question

Review this Go helper that races a primary and a fallback backend and returns whichever answers first.

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.

Talk through your review
Code to reviewgo
func Query(ctx context.Context, primary, fallback Backend) (Result, error) {	ch := make(chan Result)	go func() { ch <- primary.Do(ctx) }()	go func() { ch <- fallback.Do(ctx) }() 	select {	case r := <-ch:		return r, nil	case <-ctx.Done():		return Result{}, ctx.Err()	}}
Run or narrate your approach, then ask the coach.