Code Room
Code reviewMediumcr-g426
Subject Lock misuseLevel Mid–Senior~24 minCommon in Concurrency interviewsIndustries Software development

Question

Review this Go session store. `Touch` refreshes a session's TTL under a write lock.

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 (s *Store) Touch(id string) error {	s.mu.RLock()	sess, ok := s.m[id]	if !ok {		return ErrNotFound      // early return	}	s.mu.RUnlock() 	s.mu.Lock()	sess.expires = time.Now().Add(ttl)	s.mu.Unlock()	return nil}
Run or narrate your approach, then ask the coach.