code: func sortManifests(files map[string]string, apis chartutil.VersionSet, sort SortOrder) ([]*release.Hook, []Manifest, error) {
  	result := &result{}
  
  	for filePath, c := range files {
  
  		// Skip partials. We could return these as a separate map, but there doesn't
  		// seem to be any need for that at this time.
  		if strings.HasPrefix(path.Base(filePath), "_") {
  			continue
  		}
  		// Skip empty files and log this.
  		if len(strings.TrimSpace(c)) == 0 {
  			log.Printf("info: manifest %q is empty. Skipping.", filePath)
  			continue
  		}
  
  		manifestFile := &manifestFile{
  			entries: util.SplitManifests(c),
  			path:    filePath,
  			apis:    apis,
  		}
  
  		if err := manifestFile.sort(result); err != nil {
  			return result.hooks, result.generic, err
  		}
  	}
  
  	return result.hooks, sortByKind(result.generic, sort), nil
  }
docs: // sortManifests takes a map of filename/YAML contents, splits the file
  // by manifest entries, and sorts the entries into hook types.
  //
  // The resulting hooks struct will be populated with all of the generated hooks.
  // Any file that does not declare one of the hook types will be placed in the
  // 'generic' bucket.
  //
  // Files that do not parse into the expected format are simply placed into a map and
  // returned.