cli/command/service/progress: define const for magic value

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2024-11-04 22:01:32 +01:00
parent 3825d37923
commit 9fda9134a9
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C

View File

@ -273,8 +273,9 @@ func truncError(errMsg string) string {
// Limit the length to 75 characters, so that even on narrow terminals
// this will not overflow to the next line.
if len(errMsg) > 75 {
errMsg = errMsg[:74] + "…"
const maxWidth = 75
if len(errMsg) > maxWidth {
errMsg = errMsg[:maxWidth-1] + "…"
}
return errMsg
}