Code Room
Code reviewHard
Question
Review this Go counter type.
`go vet` complains. What is actually wrong?
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.
Learn the concepts
type Counter struct { mu sync.Mutex n int} func (c Counter) Inc() { // (1) value receiver c.mu.Lock() c.n++ c.mu.Unlock()} func (c Counter) Value() int { // (2) value receiver c.mu.Lock() defer c.mu.Unlock() return c.n}Run or narrate your approach, then ask the coach.