Code Room
Code reviewHardcr-g418
Subject DeadlocksLevel Senior–Staff~30 minCommon in Concurrency interviewsIndustries Software development

Question

Review this Go request/response pipeline. A caller sends a job and blocks for the reply on a per-call channel.

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
type Job struct{ Reply chan int } func (s *Server) Submit(j Job) int {	s.queue <- j        // hand off to worker	return <-j.Reply     // wait for result} func (s *Server) worker() {	for j := range s.queue {		result := compute(j)		select {		case j.Reply <- result:		default:			// caller gone, drop		}	}}
Run or narrate your approach, then ask the coach.