diff --git a/controllers/workspace/condition.go b/controllers/workspace/condition.go index 222b6ffbd..ae8dba5fd 100644 --- a/controllers/workspace/condition.go +++ b/controllers/workspace/condition.go @@ -16,9 +16,9 @@ package controllers import ( - "unicode" - dw "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" + "golang.org/x/text/cases" + "golang.org/x/text/language" corev1 "k8s.io/api/core/v1" "github.com/devfile/devworkspace-operator/pkg/conditions" @@ -67,7 +67,7 @@ func (c *workspaceConditions) setConditionTrueWithReason(conditionType dw.DevWor c.conditions[conditionType] = dw.DevWorkspaceCondition{ Status: corev1.ConditionTrue, - Message: capitalizeMsg(msg), + Message: cases.Title(language.English, cases.NoLower).String(msg), Reason: reason, } } @@ -132,12 +132,3 @@ func getConditionIndexInOrder(condType dw.DevWorkspaceConditionType) int { } return -1 } - -func capitalizeMsg(msg string) string { - if len(msg) == 0 { - return msg - } - runes := []rune(msg) - runes[0] = unicode.ToUpper(runes[0]) - return string(runes) -}