Code Room
Code reviewMediumcr-g596
Subject Dns lookup hot loopLevel Mid–Senior~18 minCommon in Networking & APIs interviewsIndustries Software development, Technology

Question

Review this Go worker that sends one metric per loop iteration.

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 shipMetrics(metrics <-chan Metric) {	for m := range metrics {		addr, _ := net.ResolveUDPAddr("udp", "metrics.internal:8125")		conn, _ := net.DialUDP("udp", nil, addr)		conn.Write(encode(m))		conn.Close()	}}
Run or narrate your approach, then ask the coach.