| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "strings" |
| 6 | ) |
| 7 | |
| 8 | const ( |
| 9 | benchmarkProfileBaseline = "baseline" |
| 10 | benchmarkProfileDelivery = "delivery" |
| 11 | ) |
| 12 | |
| 13 | func normalizeBenchmarkProfile(profile string) (string, error) { |
| 14 | switch strings.ToLower(strings.TrimSpace(profile)) { |
| 15 | case "", benchmarkProfileBaseline: |
| 16 | return benchmarkProfileBaseline, nil |
| 17 | case benchmarkProfileDelivery: |
| 18 | return benchmarkProfileDelivery, nil |
| 19 | default: |
| 20 | return "", fmt.Errorf("unknown benchmark profile %q (want baseline or delivery)", profile) |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | func appendBenchmarkProfileArgs(args []string, profile string) []string { |
| 25 | if profile == benchmarkProfileDelivery { |
| 26 | return append(args, "--profile", "delivery") |
| 27 | } |
| 28 | return args |
| 29 | } |
| 30 |