Code Room
Code reviewHardcr-g532
Subject Code reviewLevel Senior–Staff~22 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Go function that fans out HTTP requests and collects the first success.

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 firstOK(urls []string) (*http.Response, error) {	ch := make(chan *http.Response)	for _, u := range urls {		go func(u string) {			resp, err := http.Get(u)			if err == nil {				ch <- resp			}		}(u)	}	return <-ch, nil}
Run or narrate your approach, then ask the coach.