Code Room
Code reviewHardcr-g425
Subject Channel misuseLevel Senior–Staff~28 minCommon in Code quality & review interviewsIndustries Software development, Technology

Question

Review this Go merge loop that drains two input channels and stops when both are exhausted.

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 merge(a, b <-chan int, out chan<- int) {	for {		select {		case v, ok := <-a:			if !ok { a = nil; continue }			out <- v		case v, ok := <-b:			if !ok { continue }			out <- v		}	}}
Run or narrate your approach, then ask the coach.