code: func (s *Filesystem) Lock(info *LockInfo) (string, error) {
  	defer s.mutex()()
  
  	if s.stateFileOut == nil {
  		if err := s.createStateFiles(); err != nil {
  			return "", err
  		}
  	}
  
  	if s.lockID != "" {
  		return "", fmt.Errorf("state %q already locked", s.stateFileOut.Name())
  	}
  
  	if err := s.lock(); err != nil {
  		info, infoErr := s.lockInfo()
  		if infoErr != nil {
  			err = multierror.Append(err, infoErr)
  		}
  
  		lockErr := &LockError{
  			Info: info,
  			Err:  err,
  		}
  
  		return "", lockErr
  	}
  
  	s.lockID = info.ID
  	return s.lockID, s.writeLockInfo(info)
  }
docs: // Lock implements Locker using filesystem discretionary locks.