code: func (r *remoteClient) Unlock(id string) error {
  	ctx := context.Background()
  
  	// We first check if there was an error while uploading the latest
  	// state. If so, we will not unlock the workspace to prevent any
  	// changes from being applied until the correct state is uploaded.
  	if r.stateUploadErr {
  		return nil
  	}
  
  	lockErr := &state.LockError{Info: r.lockInfo}
  
  	// With lock info this should be treated as a normal unlock.
  	if r.lockInfo != nil {
  		// Verify the expected lock ID.
  		if r.lockInfo.ID != id {
  			lockErr.Err = fmt.Errorf("lock ID does not match existing lock")
  			return lockErr
  		}
  
  		// Unlock the workspace.
  		_, err := r.client.Workspaces.Unlock(ctx, r.workspace.ID)
  		if err != nil {
  			lockErr.Err = err
  			return lockErr
  		}
  
  		return nil
  	}
  
  	// Verify the optional force-unlock lock ID.
  	if r.organization+"/"+r.workspace.Name != id {
  		lockErr.Err = fmt.Errorf(
  			"lock ID %q does not match existing lock ID \"%s/%s\"",
  			id,
  			r.organization,
  			r.workspace.Name,
  		)
  		return lockErr
  	}
  
  	// Force unlock the workspace.
  	_, err := r.client.Workspaces.ForceUnlock(ctx, r.workspace.ID)
  	if err != nil {
  		lockErr.Err = err
  		return lockErr
  	}
  
  	return nil
  }
docs: // Unlock the remote state.