From 55a1057b5cff79ea62e67a7b7586bf61c75ddb94 Mon Sep 17 00:00:00 2001 From: Guillermo Gaston Date: Tue, 13 Jun 2023 19:31:03 +0000 Subject: [PATCH] Address review comments: renametypes and vars --- hack/tools/release/notes.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/hack/tools/release/notes.go b/hack/tools/release/notes.go index 5a3d903ca0ad..992f7381b45a 100644 --- a/hack/tools/release/notes.go +++ b/hack/tools/release/notes.go @@ -71,7 +71,7 @@ var ( tagRegex = regexp.MustCompile(`^\[release-[\w-\.]*\]`) - areaLabelsFormatMapping = map[string]string{ + userFriendlyAreas = map[string]string{ "e2e-testing": "e2e", "provider/control-plane-kubeadm": "KCP", "provider/infrastructure-docker": "CAPD", @@ -164,8 +164,8 @@ func getAreaLabel(merge string) (string, error) { return missingAreaLabelPrefix, nil case 1: area := areaLabels[0] - if formattedArea := areaLabelsFormatMapping[area]; formattedArea != "" { - area = formattedArea + if userFriendlyArea, ok := userFriendlyAreas[area]; ok { + area = userFriendlyArea } return area, nil default: @@ -291,17 +291,17 @@ func run() int { fmt.Printf("Changes since %v\n---\n", commitRange) fmt.Printf("## :chart_with_upwards_trend: Overview\n") - if size := len(commits); size > 0 { - fmt.Printf("- %d new commits merged\n", size) + if count := len(commits); count > 0 { + fmt.Printf("- %d new commits merged\n", count) } - if size := len(merges[warning]); size > 0 { - fmt.Printf("- %d breaking changes :warning:\n", size) + if count := len(merges[warning]); count > 0 { + fmt.Printf("- %d breaking changes :warning:\n", count) } - if size := len(merges[features]); size > 0 { - fmt.Printf("- %d feature additions ✨\n", size) + if count := len(merges[features]); count > 0 { + fmt.Printf("- %d feature additions ✨\n", count) } - if size := len(merges[bugs]); size > 0 { - fmt.Printf("- %d bugs fixed 🐛\n", size) + if count := len(merges[bugs]); count > 0 { + fmt.Printf("- %d bugs fixed 🐛\n", count) } fmt.Println()