code: func (o *Options) CheckPermissions() error {
  	// get the directory the file exists in
  	path, err := o.getPath()
  	if err != nil {
  		return err
  	}
  
  	fileDir := filepath.Dir(path)
  	fileName := filepath.Base(path)
  
  	// attempt to open a file in the file's directory
  	newPath := filepath.Join(fileDir, fmt.Sprintf(".%s.new", fileName))
  	fp, err := openFile(newPath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, o.TargetMode)
  	if err != nil {
  		return err
  	}
  	fp.Close()
  
  	_ = os.Remove(newPath)
  	return nil
  }
docs: // CheckPermissions determines whether the process has the correct permissions to
  // perform the requested update. If the update can proceed, it returns nil, otherwise
  // it returns the error that would occur if an update were attempted.