(templateFormat string)
| 238 | } |
| 239 | |
| 240 | func newVersionTemplate(templateFormat string) (*template.Template, error) { |
| 241 | switch templateFormat { |
| 242 | case "": |
| 243 | templateFormat = defaultVersionTemplate |
| 244 | case formatter.JSONFormatKey: |
| 245 | templateFormat = formatter.JSONFormat |
| 246 | } |
| 247 | tmpl, err := templates.New("version").Funcs(template.FuncMap{"getDetailsOrder": getDetailsOrder}).Parse(templateFormat) |
| 248 | if err != nil { |
| 249 | return nil, fmt.Errorf("template parsing error: %w", err) |
| 250 | } |
| 251 | return tmpl, nil |
| 252 | } |
| 253 | |
| 254 | func getDetailsOrder(v system.ComponentVersion) []string { |
| 255 | out := make([]string, 0, len(v.Details)) |
no outgoing calls
searching dependent graphs…