Skip to content

Commit 6dadf49

Browse files
HoriodinoAObuchow
authored andcommitted
feat: ensure all DevWorkspace condition messages are capitalized
Fix #1092 Signed-off-by: Horiodino <[email protected]>
1 parent 58cd8f0 commit 6dadf49

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

controllers/workspace/condition.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
package controllers
1717

1818
import (
19+
"unicode"
20+
1921
dw "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
2022
corev1 "k8s.io/api/core/v1"
2123

@@ -65,7 +67,7 @@ func (c *workspaceConditions) setConditionTrueWithReason(conditionType dw.DevWor
6567

6668
c.conditions[conditionType] = dw.DevWorkspaceCondition{
6769
Status: corev1.ConditionTrue,
68-
Message: msg,
70+
Message: capitalizeMessage(msg),
6971
Reason: reason,
7072
}
7173
}
@@ -130,3 +132,13 @@ func getConditionIndexInOrder(condType dw.DevWorkspaceConditionType) int {
130132
}
131133
return -1
132134
}
135+
136+
// Capitalizes the first character in the given string.
137+
func capitalizeMessage(msg string) string {
138+
if msg == "" {
139+
return msg
140+
}
141+
runes := []rune(msg)
142+
runes[0] = unicode.ToUpper(runes[0])
143+
return string(runes)
144+
}

0 commit comments

Comments
 (0)