@@ -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}
@@ -172,8 +172,11 @@ func ValidateDeviceName(name string) error {
172172 if name == "" {
173173 return errors .Errorf ("invalid (empty) device name" )
174174 }
175- if ! isLetter (rune (name [0 ])) {
176- return errors .Errorf ("invalid name %q, should start with letter" , name )
175+ if ! isAlphaNumeric (rune (name [0 ])) {
176+ return errors .Errorf ("invalid class %q, should start with a letter or digit" , name )
177+ }
178+ if len (name ) == 1 {
179+ return nil
177180 }
178181 for _ , c := range string (name [1 : len (name )- 1 ]) {
179182 switch {
@@ -185,7 +188,7 @@ func ValidateDeviceName(name string) error {
185188 }
186189 }
187190 if ! isAlphaNumeric (rune (name [len (name )- 1 ])) {
188- 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 )
189192 }
190193 return nil
191194}
0 commit comments