Code Room
Code reviewHardcr-g234
Subject Lock misuseLevel Senior–Staff~40 minCommon in Concurrency interviewsIndustries Software development

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.

Talk through your review
Code to reviewgo
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.