Skip to content

Commit 045438e

Browse files
committed
Fix error message when parsing qualified names
The error message returned when the last character of vendor, class, or device names did not match the criteria checked. This change updates the error message. Signed-off-by: Evan Lezar <[email protected]>
1 parent ca19fd8 commit 045438e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/cdi/qualified-device.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func ValidateVendorName(vendor string) error {
130130
}
131131
}
132132
if !isAlphaNumeric(rune(vendor[len(vendor)-1])) {
133-
return errors.Errorf("invalid vendor %q, should end with letter", vendor)
133+
return errors.Errorf("invalid vendor %q, should end with a letter or digit", vendor)
134134
}
135135

136136
return nil
@@ -158,7 +158,7 @@ func ValidateClassName(class string) error {
158158
}
159159
}
160160
if !isAlphaNumeric(rune(class[len(class)-1])) {
161-
return errors.Errorf("invalid class %q, should end with letter", class)
161+
return errors.Errorf("invalid class %q, should end with a letter or digit", class)
162162
}
163163
return nil
164164
}
@@ -188,7 +188,7 @@ func ValidateDeviceName(name string) error {
188188
}
189189
}
190190
if !isAlphaNumeric(rune(name[len(name)-1])) {
191-
return errors.Errorf("invalid name %q, should start with letter", name)
191+
return errors.Errorf("invalid name %q, should end with a letter or digit", name)
192192
}
193193
return nil
194194
}

0 commit comments

Comments
 (0)