code: func (t *Task) guardResolution(fn func() error) error {
  	t.resolvedMu.Lock()
  	defer t.resolvedMu.Unlock()
  	if t.resolved {
  		return ErrAlreadyResolved
  	}
  
  	err := fn()
  	if err == nil {
  		t.resolved = true
  	}
  
  	return err
  }
docs: // guardResolution runs the inner fn only if the task is not already resolved,
  // returning ErrAlreadyResolved if that's not the case. If the inner function
  // returns no error, the task will subsequently be marked as resolved.