Code Room
Code reviewHardcr-g018
Subject Concurrency bugsLevel Senior–Staff~26 minCommon in Concurrency interviewsIndustries Software development

Question

Review this Go batch runner.

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 runAll(jobs []Job) []Result {	var wg sync.WaitGroup	results := make([]Result, len(jobs))	for i, j := range jobs {		go func(i int, j Job) {			wg.Add(1)			defer wg.Done()			results[i] = run(j)		}(i, j)	}	wg.Wait()	return results}
Run or narrate your approach, then ask the coach.