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

Question

Review this Go config holder. `Snapshot` returns a copy of the config for read-only use by handlers.

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 Config struct {	mu     sync.Mutex	Values map[string]string} func (c *Config) Set(k, v string) {	c.mu.Lock()	c.Values[k] = v	c.mu.Unlock()} func (c *Config) Snapshot() Config {	c.mu.Lock()	defer c.mu.Unlock()	return *c            // copy under lock}
Run or narrate your approach, then ask the coach.