diff --git a/main.go b/main.go index 5623e63..1ea38db 100644 --- a/main.go +++ b/main.go @@ -364,6 +364,7 @@ func parseCopyLabels(copyLabelsString string) []string { if copyLabelsString == "*" { return []string{"*"} } +<<<<<<< HEAD if copyLabelsString == "" { return []string{} } @@ -371,4 +372,15 @@ func parseCopyLabels(copyLabelsString string) []string { return strings.FieldsFunc(copyLabelsString, func(c rune) bool { return c == ',' }) +||||||| parent of 36790c1 (handle empty strings in copy-labels list) + if copyLabelsString == "" { + return []string{} + } + return strings.Split(copyLabelsString, ",") +======= + // remove empty strings from final list, eg: "foo,,bar" -> ["foo" "bar"]: + return strings.FieldsFunc(copyLabelsString, func(c rune) bool { + return c == ',' + }) +>>>>>>> 36790c1 (handle empty strings in copy-labels list) } diff --git a/main_test.go b/main_test.go index 8b4f046..3797d5a 100644 --- a/main_test.go +++ b/main_test.go @@ -105,11 +105,20 @@ func Test_parseCopyLabels(t *testing.T) { copyLabelsString: "", want: []string{}, }, +<<<<<<< HEAD { name: "empty values in list", copyLabelsString: "foo,,bar", want: []string{"foo", "bar"}, }, +||||||| parent of 36790c1 (handle empty strings in copy-labels list) +======= + { + name: "empty values in list are removed", + copyLabelsString: "foo,,bar", + want: []string{"foo", "bar"}, + }, +>>>>>>> 36790c1 (handle empty strings in copy-labels list) } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {