code: func (s *Semaphore) decodeLock(pair *KVPair) (*semaphoreLock, error) {
  	// Handle if there is no lock
  	if pair == nil || pair.Value == nil {
  		return &semaphoreLock{
  			Limit:   s.opts.Limit,
  			Holders: make(map[string]bool),
  		}, nil
  	}
  
  	l := &semaphoreLock{}
  	if err := json.Unmarshal(pair.Value, l); err != nil {
  		return nil, fmt.Errorf("lock decoding failed: %v", err)
  	}
  	return l, nil
  }
docs: // decodeLock is used to decode a semaphoreLock from an
  // entry in Consul