code: func (e *Env) Delete(c context.Context) error {
  	removedLock := false
  	err := e.withExclusiveLockNonBlocking(func() error {
  		logging.Debugf(c, "(Delete) Got exclusive lock for: %s", e.Name)
  
  		// Delete our environment directory.
  		if err := filesystem.RemoveAll(e.Root); err != nil {
  			return errors.Annotate(err, "failed to delete environment root").Err()
  		}
  
  		// Attempt to delete our lock. On POSIX systems, this will successfully
  		// delete the lock. On Windows systems, there will be contention, since the
  		// lock is held by us.
  		//
  		// In this case, we'll try again to delete it after we release the lock.
  		// If someone else takes out the lock in between, the delete will similarly
  		// fail.
  		if err := os.Remove(e.lockPath); err == nil {
  			removedLock = true
  		} else {
  			logging.WithError(err).Debugf(c, "failed to delete lock file while holding lock: %s", e.lockPath)
  		}
  		return nil
  	})
  	logging.Debugf(c, "(Delete) Released exclusive lock for: %s", e.Name)
  
  	if err != nil {
  		return errors.Annotate(err, "failed to delete environment").Err()
  	}
  
  	// Try and remove the lock now that we don't hold it.
  	if !removedLock {
  		if err := os.Remove(e.lockPath); err != nil {
  			return errors.Annotate(err, "failed to remove lock").Err()
  		}
  	}
  	return nil
  }
docs: // Delete removes all resources consumed by an environment.
  //
  // Delete will acquire an exclusive lock on the environment and assert that it
  // is not in use prior to deletion. This is non-blocking, and an error will be
  // returned if the lock could not be acquired.
  //
  // If the environment was not deleted, a non-nil wrapped error will be returned.
  // If the deletion failed because the lock was held, a wrapped
  // fslock.ErrLockHeld  will be returned.