Code Room
Code reviewHardcr-g412
Subject Atomicity violationsLevel Senior–Staff~28 minCommon in Concurrency interviewsIndustries Software development, Technology

Question

Review this Go high-water-mark tracker that records the largest latency seen, called from many request goroutines.

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 HighWater struct {	max atomic.Int64} func (h *HighWater) Observe(latencyNs int64) {	if latencyNs > h.max.Load() {		h.max.Store(latencyNs)	}} func (h *HighWater) Max() int64 { return h.max.Load() }
Run or narrate your approach, then ask the coach.