code: func (w *AtomicWriter) pathsToRemove(payload map[string]FileProjection, oldTsDir string) (sets.String, error) {
  	paths := sets.NewString()
  	visitor := func(path string, info os.FileInfo, err error) error {
  		relativePath := strings.TrimPrefix(path, oldTsDir)
  		relativePath = strings.TrimPrefix(relativePath, string(os.PathSeparator))
  		if relativePath == "" {
  			return nil
  		}
  
  		paths.Insert(relativePath)
  		return nil
  	}
  
  	err := filepath.Walk(oldTsDir, visitor)
  	if os.IsNotExist(err) {
  		return nil, nil
  	} else if err != nil {
  		return nil, err
  	}
  	klog.V(5).Infof("%s: current paths:   %+v", w.targetDir, paths.List())
  
  	newPaths := sets.NewString()
  	for file := range payload {
  		// add all subpaths for the payload to the set of new paths
  		// to avoid attempting to remove non-empty dirs
  		for subPath := file; subPath != ""; {
  			newPaths.Insert(subPath)
  			subPath, _ = filepath.Split(subPath)
  			subPath = strings.TrimSuffix(subPath, string(os.PathSeparator))
  		}
  	}
  	klog.V(5).Infof("%s: new paths:       %+v", w.targetDir, newPaths.List())
  
  	result := paths.Difference(newPaths)
  	klog.V(5).Infof("%s: paths to remove: %+v", w.targetDir, result)
  
  	return result, nil
  }
docs: // pathsToRemove walks the current version of the data directory and
  // determines which paths should be removed (if any) after the payload is
  // written to the target directory.