MCPcopy Index your code
hub / github.com/databus23/helm-diff / reIndexForRelease

Function reIndexForRelease

diff/diff.go:569–595  ·  view source on GitHub ↗

reIndexForRelease based on template names

(index map[string]*manifest.MappingResult)

Source from the content-addressed store, hash-verified

567
568// reIndexForRelease based on template names
569func reIndexForRelease(index map[string]*manifest.MappingResult) map[string]*manifest.MappingResult {
570 // sort the index to iterate map in the same order
571 var keys []string
572 for key := range index {
573 keys = append(keys, key)
574 }
575 sort.Strings(keys)
576
577 // holds number of object in a single file
578 count := make(map[string]int)
579
580 newIndex := make(map[string]*manifest.MappingResult)
581
582 for key := range keys {
583 str := strings.Replace(strings.Split(index[keys[key]].Content, "\n")[0], "# Source: ", "", 1)
584
585 if _, ok := newIndex[str]; ok {
586 count[str]++
587 str += fmt.Sprintf(" %d", count[str])
588 newIndex[str] = index[keys[key]]
589 } else {
590 newIndex[str] = index[keys[key]]
591 count[str]++
592 }
593 }
594 return newIndex
595}
596
597func sortedKeys(manifests map[string]*manifest.MappingResult) []string {
598 var keys []string

Callers 1

ReleasesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected