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

Method loadFromKey

diff/report.go:297–308  ·  view source on GitHub ↗

report with template output will only have access to ReportTemplateSpec. This function reverts parsedMetadata.String()

(key string)

Source from the content-addressed store, hash-verified

295// report with template output will only have access to ReportTemplateSpec.
296// This function reverts parsedMetadata.String()
297func (t *ReportTemplateSpec) loadFromKey(key string) error {
298 pattern := regexp.MustCompile(`(?P<namespace>[a-z0-9-]+), (?P<name>[a-z0-9.-]+), (?P<kind>\w+) \((?P<api>[^)]+)\)`)
299 matches := pattern.FindStringSubmatch(key)
300 if len(matches) > 1 {
301 t.Namespace = matches[1]
302 t.Name = matches[2]
303 t.Kind = matches[3]
304 t.API = matches[4]
305 return nil
306 }
307 return errors.New("key string didn't match regexp")
308}
309
310// load and print report for template output
311func templateReportPrinter(t *template.Template) func(r *Report, to io.Writer) {

Callers 3

populateMetadataMethod · 0.95
TestLoadFromKeyFunction · 0.95
templateReportPrinterFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestLoadFromKeyFunction · 0.76